ifconfig添加删除ip地址

[root@x101 conf.d]# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.0.101 netmask 255.255.255.0 broadcast 192.168.0.255

[root@x101 conf.d]# ifconfig eth0:1 192.168.0.102/24
[root@x101 conf.d]# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.0.101 netmask 255.255.255.0 broadcast 192.168.0.255

eth0:1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500

inet 192.168.0.102 netmask 255.255.255.0 broadcast 192.168.0.255

ifconfig eth0:1 down

[root@x101 conf.d]# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.0.101 netmask 255.255.255.0 broadcast 192.168.0.255

 

ip address 添加删除ip地址

[root@x101 ~]# ip addr add 192.168.0.102/24 dev eth0 label eth0:1
[root@x101 ~]# ip addr show
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:0c:29:bc:12:d3 brd ff:ff:ff:ff:ff:ff
inet 192.168.0.101/24 brd 192.168.0.255 scope global dynamic eth0
valid_lft 5323sec preferred_lft 5323sec
inet 192.168.0.102/24 scope global secondary eth0:1
[root@x101 ~]#

 

[root@x101 ~]# ip addr del 192.168.0.102/24 dev eth0:1
[root@x101 ~]# ip addr show
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:0c:29:bc:12:d3 brd ff:ff:ff:ff:ff:ff
inet 192.168.0.101/24 brd 192.168.0.255 scope global dynamic eth0
valid_lft 5152sec preferred_lft 5152sec

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-12-18
  • 2021-10-16
  • 2021-11-11
  • 2022-02-20
  • 2022-12-23
  • 2021-12-30
猜你喜欢
  • 2022-12-23
  • 2021-12-09
  • 2022-01-27
  • 2022-02-22
  • 2021-10-15
  • 2021-07-21
  • 2022-12-23
相关资源
相似解决方案