Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2414633
  • 博文数量: 298
  • 博客积分: 7876
  • 博客等级: 准将
  • 技术积分: 5500
  • 用 户 组: 普通用户
  • 注册时间: 2011-02-23 13:39
文章存档

2013年(2)

2012年(142)

2011年(154)

分类: LINUX

2011-04-07 13:52:43

Linux系统在线增加多个ip

 

首先查看ip
代码:
linuxedu.net# ifconfig

eth0 Link encap:Ethernet HWaddr 00:50:BA:EF:21:E2
inet addr:192.168.1.1 Bcast:192.168.1.255 mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:3433865 errors:0 dropped:0 overruns:0 frame:0
TX packets:2730922 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:2610363482 (2489.4 Mb) TX bytes:577832769 (551.0 Mb)
Interrupt:11 Base address:0xc000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:811139 errors:0 dropped:0 overruns:0 frame:0
TX packets:811139 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2007636558 (1914.6 Mb) TX bytes:2007636558 (1914.6 Mb)

添加ip

代码:
ifconfig eth0:0 192.168.1.2 netmask 255.255.255.255 up

在查看.
代码:
linuxedu.net# ifconfig

eth0 Link encap:Ethernet HWaddr 00:50:BA:EF:21:E2
inet addr:192.168.1.1 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:3433865 errors:0 dropped:0 overruns:0 frame:0
TX packets:2730922 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:2610363482 (2489.4 Mb) TX bytes:577832769 (551.0 Mb)
Interrupt:11 Base address:0xc000
eth0:0 Link encap:Ethernet HWaddr 00:50:BA:EF:21:E2
inet addr:192.168.1.2 Bcast:192.168.1.255 Mask:255.255.255.255
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:3433471 errors:0 dropped:0 overruns:0 frame:0
TX packets:2730637 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:2610321034 (2489.3 Mb) TX bytes:577696691 (550.9 Mb)
Interrupt:11 Base address:0xc000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:811139 errors:0 dropped:0 overruns:0 frame:0
TX packets:811139 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2007636558 (1914.6 Mb) TX bytes:2007636558 (1914.6 Mb)
最后写到文件里,使从新启动时生效.
vi /etc/sysconfig/network-scripts/ifcfg-eth0:0
代码:

DEVICE=eth0:0
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.1.2


去掉ip
代码:
ifconfig eth0:0 192.168.1.2 netmask 255.255.255.255 down
rm /etc/sysconfig/network-scripts/ifcfg-eth0:0

阅读(1082) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~