1. 程式人生 > >hisi 配置靜態IP地址

hisi 配置靜態IP地址

靜態IP地址配置檔案路徑 /etc/network/interfaces

interfaces格式

#設定單個ipv4地址
The loopback interface
auto lo
iface lo inet loopback
						
auto eth0
iface eth0 inet static
address 192.168.9.51
netmask 255.255.252.0
gateway 192.168.9.1
mtu 1500
#設定單個ipv6地址
#The loopback interface
auto lo
iface lo inet loopback
						
auto eth0
iface eth0 inet6 static
address 2001:f80:754::51
netmask 64           
gateway 2001:f80:754::1
mtu 1500
#同時設定ipv4和ipv6地址
#The loopback interface
auto lo
iface lo inet loopback
						
auto eth0
iface eth0 inet6 static
address 2001:f80:754::51
netmask 64
gateway 2001:f80:754::1
mtu 1500
						
iface eth0 inet static
address 192.168.9.58
netmask 255.255.252.0
gateway 192.168.9.1
mtu 1500
#設定多個ipv4地址
#The loopback interface
auto lo
iface lo inet loopback
						
auto eth0 eth0:1
iface eth0 inet6 static
address 2001:f80:754::51
netmask 64
gateway 2001:f80:754::1
mtu 1500
						
iface eth0 inet static
address 192.168.9.58
netmask 255.255.252.0
gateway 192.168.9.1
mtu 1500
						
iface eth0:1 inet static
address 192.168.9.59
netmask 255.255.252.0
gateway 192.168.9.1
mtu 1500

#注:有幾個地址就配置幾個介面。冒號後面的數字可以隨便寫的,只要幾個配置的名字不重複就可以。
但是要記住重啟網絡卡時ifup 對應的介面名字,比如ifup eth0:1

 

命令列新增IP地址

ifconfig eth0 add 2001:f80:754::4/64