{"id":192411,"date":"2020-05-31T08:23:18","date_gmt":"2020-05-31T00:23:18","guid":{"rendered":"https:\/\/gulass.cn\/?p=192411"},"modified":"2020-05-25T09:21:49","modified_gmt":"2020-05-25T01:21:49","slug":"ubuntu-18-04-1-basic-operation","status":"publish","type":"post","link":"https:\/\/gulass.cn\/ubuntu-18-04-1-basic-operation.html","title":{"rendered":"Ubuntu 18.04.1 \u57fa\u672c\u64cd\u4f5c"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n\u672c\u6587\u6863\u4ecb\u7ecd Ubuntu 18.04.1 \u57fa\u672c\u64cd\u4f5c<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n
\u5374\u6362\u5230 root \u5e76\u66f4\u6539\u5bc6\u7801<\/strong><\/div>\n

\u7528\u666e\u901a\u7528\u6237\u767b\u5f55\u7cfb\u7edf\u540e\uff0c\u6267\u884c sudo -s \u547d\u4ee4\u5207\u6362\u5230 root \u6a21\u5f0f<\/p>\n

\"\"<\/p>\n

\u66f4\u6539 root \u5bc6\u7801<\/p>\n

\"\"<\/p>\n

\u66f4\u6539\u7f51\u5361\u914d\u7f6e<\/strong><\/div>\n
\u9759\u6001IP<\/strong><\/span><\/div>\n
root@jaking-virtual-machine:~# vim \/etc\/network\/interfaces\r\nroot@jaking-virtual-machine:~# cat \/etc\/network\/interfaces\r\n# interfaces(5) file used by ifup(8) and ifdown(8)\r\nauto lo\r\niface lo inet loopback\r\n\r\nauto ens33\r\niface ens33 inet static\r\naddress 192.168.10.6\r\ngateway 192.168.10.2\r\nnetmask 255.255.255.0\r\ndns-nameservers 114.114.114.114\r\n\r\nroot@jaking-virtual-machine:~# \/etc\/init.d\/networking restart\r\n[ ok ] Restarting networking (via systemctl): networking.service.\r\nroot@jaking-virtual-machine:~# ifconfig\r\nens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500\r\n        inet 192.168.10.6  netmask 255.255.255.0  broadcast 192.168.10.255\r\n        inet6 fe80::20c:29ff:fe05:75fb  prefixlen 64  scopeid 0x20\r\n        ether 00:0c:29:05:75:fb  txqueuelen 1000  (Ethernet)\r\n        RX packets 7529  bytes 9810758 (9.8 MB)\r\n        RX errors 0  dropped 0  overruns 0  frame 0\r\n        TX packets 2430  bytes 233194 (233.1 KB)\r\n        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0\r\n\r\nlo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536\r\n        inet 127.0.0.1  netmask 255.0.0.0\r\n        inet6 ::1  prefixlen 128  scopeid 0x10\r\n        loop  txqueuelen 1000  (Local Loopback)\r\n        RX packets 322  bytes 25983 (25.9 KB)\r\n        RX errors 0  dropped 0  overruns 0  frame 0\r\n        TX packets 322  bytes 25983 (25.9 KB)\r\n        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0\r\n<\/pre>\n
\u52a8\u6001IP<\/strong><\/span><\/div>\n
root@jaking-virtual-machine:~# vim \/etc\/network\/interfaces\r\nroot@jaking-virtual-machine:~# cat \/etc\/network\/interfaces\r\n# interfaces(5) file used by ifup(8) and ifdown(8)\r\nauto lo\r\niface lo inet loopback\r\n\r\nauto ens33\r\niface ens33 inet dhcp\r\n#address 192.168.10.6\r\n#gateway 192.168.10.2\r\n#netmask 255.255.255.0\r\n#dns-nameservers 114.114.114.114\r\n\r\nroot@jaking-virtual-machine:~# \/etc\/init.d\/networking restart\r\n[ ok ] Restarting networking (via systemctl): networking.service.\r\nroot@jaking-virtual-machine:~# ifconfig\r\nens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500\r\n        inet 192.168.10.10  netmask 255.255.255.0  broadcast 192.168.10.255\r\n        inet6 fe80::20c:29ff:fe05:75fb  prefixlen 64  scopeid 0x20\r\n        ether 00:0c:29:05:75:fb  txqueuelen 1000  (Ethernet)\r\n        RX packets 7637  bytes 9823020 (9.8 MB)\r\n        RX errors 0  dropped 0  overruns 0  frame 0\r\n        TX packets 2606  bytes 253459 (253.4 KB)\r\n        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0\r\n\r\nlo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536\r\n        inet 127.0.0.1  netmask 255.0.0.0\r\n        inet6 ::1  prefixlen 128  scopeid 0x10\r\n        loop  txqueuelen 1000  (Local Loopback)\r\n        RX packets 393  bytes 30932 (30.9 KB)\r\n        RX errors 0  dropped 0  overruns 0  frame 0\r\n        TX packets 393  bytes 30932 (30.9 KB)\r\n        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0\r\n\r\nroot@jaking-virtual-machine:~# ping www.baidu.com\r\nPING www.baidu.com (14.215.177.38) 56(84) bytes of data.\r\n64 bytes from www.baidu.com (14.215.177.38): icmp_seq=1 ttl=128 time=7.42 ms\r\n64 bytes from www.baidu.com (14.215.177.38): icmp_seq=2 ttl=128 time=7.18 ms\r\n64 bytes from www.baidu.com (14.215.177.38): icmp_seq=3 ttl=128 time=7.96 ms\r\n64 bytes from www.baidu.com (14.215.177.38): icmp_seq=4 ttl=128 time=7.32 ms\r\n^C\r\n--- www.baidu.com ping statistics ---\r\n4 packets transmitted, 4 received, 0% packet loss, time 3006ms\r\nrtt min\/avg\/max\/mdev = 7.182\/7.472\/7.963\/0.314 ms\r\n<\/pre>\n
\u4e34\u65f6IP<\/strong><\/span><\/div>\n
root@jaking-virtual-machine:~# ifconfig\r\nens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500\r\n        inet 192.168.10.6  netmask 255.255.255.0  broadcast 192.168.10.255\r\n        inet6 fe80::20c:29ff:fe05:75fb  prefixlen 64  scopeid 0x20\r\n        ether 00:0c:29:05:75:fb  txqueuelen 1000  (Ethernet)\r\n        RX packets 348  bytes 34488 (34.4 KB)\r\n        RX errors 0  dropped 0  overruns 0  frame 0\r\n        TX packets 575  bytes 48711 (48.7 KB)\r\n        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0\r\n\r\nlo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536\r\n        inet 127.0.0.1  netmask 255.0.0.0\r\n        inet6 ::1  prefixlen 128  scopeid 0x10\r\n        loop  txqueuelen 1000  (Local Loopback)\r\n        RX packets 976  bytes 82275 (82.2 KB)\r\n        RX errors 0  dropped 0  overruns 0  frame 0\r\n        TX packets 976  bytes 82275 (82.2 KB)\r\n        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0\r\nroot@jaking-virtual-machine:~# ping www.163.com\r\nPING z163ipv6.v.bsgslb.cn (183.47.233.6) 56(84) bytes of data.\r\n64 bytes from 183.47.233.6 (183.47.233.6): icmp_seq=1 ttl=128 time=5.09 ms\r\n64 bytes from 183.47.233.6 (183.47.233.6): icmp_seq=2 ttl=128 time=8.10 ms\r\n64 bytes from 183.47.233.6 (183.47.233.6): icmp_seq=3 ttl=128 time=6.68 ms\r\n64 bytes from 183.47.233.6 (183.47.233.6): icmp_seq=4 ttl=128 time=5.93 ms\r\n^C\r\n--- z163ipv6.v.bsgslb.cn ping statistics ---\r\n4 packets transmitted, 4 received, 0% packet loss, time 3006ms\r\nrtt min\/avg\/max\/mdev = 5.094\/6.457\/8.109\/1.110 ms\r\n\r\nroot@jaking-virtual-machine:~# ifconfig ens33 192.168.100.163\r\nroot@jaking-virtual-machine:~# ifconfig\r\nens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500\r\n        inet 192.168.100.163  netmask 255.255.255.0  broadcast 192.168.100.255\r\n        inet6 fe80::20c:29ff:fe05:75fb  prefixlen 64  scopeid 0x20\r\n        ether 00:0c:29:05:75:fb  txqueuelen 1000  (Ethernet)\r\n        RX packets 351  bytes 34885 (34.8 KB)\r\n        RX errors 0  dropped 0  overruns 0  frame 0\r\n        TX packets 586  bytes 50269 (50.2 KB)\r\n        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0\r\n\r\nlo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536\r\n        inet 127.0.0.1  netmask 255.0.0.0\r\n        inet6 ::1  prefixlen 128  scopeid 0x10\r\n        loop  txqueuelen 1000  (Local Loopback)\r\n        RX packets 980  bytes 82521 (82.5 KB)\r\n        RX errors 0  dropped 0  overruns 0  frame 0\r\n        TX packets 980  bytes 82521 (82.5 KB)\r\n        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0\r\n\r\nroot@jaking-virtual-machine:~# ping www.163.com\r\nping: www.163.com: Name or service not known\r\n<\/pre>\n
\u914d\u7f6e DNS<\/strong><\/div>\n
root@jaking-virtual-machine:~# vim \/etc\/systemd\/resolved.conf \r\nroot@jaking-virtual-machine:~# cat \/etc\/systemd\/resolved.conf \r\n#  This file is part of systemd.\r\n#\r\n#  systemd is free software; you can redistribute it and\/or modify it\r\n#  under the terms of the GNU Lesser General Public License as published by\r\n#  the Free Software Foundation; either version 2.1 of the License, or\r\n#  (at your option) any later version.\r\n#\r\n# Entries in this file show the compile time defaults.\r\n# You can change settings by editing this file.\r\n# Defaults can be restored by simply deleting this file.\r\n#\r\n# See resolved.conf(5) for details\r\n\r\n[Resolve]\r\n#DNS=192.168.10.2\r\nDNS=114.114.114.114\r\n#FallbackDNS=\r\n#Domains=\r\n#LLMNR=no\r\n#MulticastDNS=no\r\n#DNSSEC=no\r\n#Cache=yes\r\n#DNSStubListener=yes\r\n<\/pre>\n

\u6539\u5b8cDNS\u540e\uff0c\u6700\u597d\u91cd\u542f\u4e00\u4e0bUbuntu\u7cfb\u7edf\u3002<\/p>\n

\u603b\u7ed3<\/strong><\/div>\n

\u4ee5\u4e0a\u5c31\u662f Ubuntu 18.04.1 \u7684\u57fa\u672c\u64cd\u4f5c\uff0c\u5e0c\u671b\u80fd\u5e2e\u52a9\u5230\u5927\u5bb6\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

\u7528\u666e\u901a\u7528\u6237\u767b\u5f55\u7cfb\u7edf\u540e\uff0c\u6267\u884c sudo -s \u547d\u4ee4\u5207\u6362\u5230 root \u6a21\u5f0f \u66f4\u6539 root \u5bc6\u7801 root@jak […]<\/p>\n","protected":false},"author":63,"featured_media":192412,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-192411","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/192411","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/users\/63"}],"replies":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/comments?post=192411"}],"version-history":[{"count":3,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/192411\/revisions"}],"predecessor-version":[{"id":192471,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/192411\/revisions\/192471"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/media\/192412"}],"wp:attachment":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/media?parent=192411"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/categories?post=192411"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/tags?post=192411"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}