先查詢網路設備 ifconfig or networkctl
# ifconfig -a
ens33 Link encap:Ethernet HWaddr 00:0c:29:da:d1:b0
inet addr:10.10.8.57 Bcast:10.10.8.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:feda:d1b0/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:9149 errors:0 dropped:45 overruns:0 frame:0
TX packets:963 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:950063 (950.0 KB) TX bytes:408797 (408.7 KB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:264 errors:0 dropped:0 overruns:0 frame:0
TX packets:264 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:19200 (19.2 KB) TX bytes:19200 (19.2 KB)
# networkctl -a
WARNING: systemd-networkd is not running, output will be incomplete.
IDX LINK TYPE OPERATIONAL SETUP
1 lo loopback n/a unmanaged
2 ens33 ether n/a unmanaged
2 links listed.
** ubuntu 16.04 系統 基本為DHCP模式
修正為分配固定 ip
# vi /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
#auto ens33
#iface ens33 inet dhcp
auto ens33
iface ens33 inet static
address 10.10.8.57
netmask 255.255.255.0
gateway 10.10.8.254
dns-nameservers 10.10.0.9 10.10.0.10
重新啟用網路設定
# /etc/init.d/networking restart
沒有留言:
張貼留言