歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> 關於Linux >> linux系統綁定多IP配置

linux系統綁定多IP配置

日期:2017/3/1 16:35:38   编辑:關於Linux
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
Copyright © Linux教程網 All Rights Reserved