hisi 配置静态IP地址

28 篇文章 0 订阅
7 篇文章 1 订阅

静态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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值