linux系统绑定多IP配置


linux系统绑定多IP配置
 
最近使用sipP要用到单网卡绑定多IP地址,我的系统是Ubuntu12.04,具体配置如下:
我的系统只有一个网卡eth0,单网卡绑定多ip需要设置/etc/network/interface文件
文件修改前配置如下:  www.2cto.com  
# The loopback network interface
auto lo
iface lo inet loopback
 
 
# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.82.1
netmask 255.255.0.0
gateway 192.168.0.1
修改后配置为:
auto lo
iface lo inet loopback
 
 
# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.82.1
netmask 255.255.0.0
gateway 192.168.0.1
 
 
auto eth0:0
iface eth0:0 inet static
address 192.168.82.2
netmask 255.255.0.0
auto eth0:1
iface eth0:1 inet static
address 192.168.82.3
netmask 255.255.0.0
auto eth0:2
iface eth0:2 inet static
address 192.168.82.4
netmask 255.255.0.0
........
具体需要绑定多少ip根据自己需要而定
保存后退出
执行命令/etc/init.d/networking restart 重启网卡
ifconfig命令查看ip地址
eth0      Link encap:??????  ???????· 00:0c:29:5d:ef:bb  
          inet ???·:192.168.82.1  ????:192.168.255.255  ????:255.255.0.0
          inet6 ???·: fe80::20c:29ff:fe5d:efbb/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  ??????:1
          ????????°ü:3170483732 ?í?ó:1400 ???ú:2719 ????:0 ????:0
          ·???????°ü:3145233717 ?í?ó:0 ???ú:0 ????:0 ???¨:0
          ??×?:0 ·????????¤??:1000 
          ????×???:2525684660 (2.5 GB)  ·???×???:1704702676 (1.7 GB)
          ????:19 ?ù±????·:0x2000 
 
eth0:0    Link encap:??????  ???????· 00:0c:29:5d:ef:bb  
          inet ???·:192.168.82.2  ????:192.168.255.255  ????:255.255.0.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  ??????:1
          ????:19 ?ù±????·:0x2000 
 
eth0:1    Link encap:??????  ???????· 00:0c:29:5d:ef:bb  
          inet ???·:192.168.82.3  ????:192.168.255.255  ????:255.255.0.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  ??????:1
          ????:19 ?ù±????·:0x2000 
 
eth0:2    Link encap:??????  ???????· 00:0c:29:5d:ef:bb  
          inet ???·:192.168.82.4  ????:192.168.255.255  ????:255.255.0.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  ??????:1
          ????:19 ?ù±????·:0x2000 
lo        Link encap:±????·??  
          inet ???·:127.0.0.1  ????:255.0.0.0
          inet6 ???·: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  ??????:1
          ????????°ü:80 ?í?ó:0 ???ú:0 ????:0 ????:0
          ·???????°ü:80 ?í?ó:0 ???ú:0 ????:0 ???¨:0
          ??×?:0 ·????????¤??:0 
          ????×???:39904 (39.9 KB)  ·???×???:39904 (39.9 KB
 
最后ping下新加的地址,可以ping通就没问题啦。
root@ubuntu:~/sipp.svn/uas# ping 192.168.82.2
PING 192.168.82.2 (192.168.82.2) 56(84) bytes of data.
64 bytes from 192.168.82.2: icmp_req=1 ttl=64 time=0.199 ms
64 bytes from 192.168.82.2: icmp_req=2 ttl=64 time=0.089 ms
 

相关内容

    暂无相关文章