Linux下单网卡设置双ip,ubuntu设置双IP
来源:互联网 发布:数据收集平台 编辑:程序博客网 时间:2024/05/21 11:19
ubuntu设置双IP
环境:Ubuntu 8.10 server 64bit
Ubuntu的网卡配置文件是/etc/network/interfaces
修改一下这个配置文件就可以单网卡绑定两个ip,或者设置多个ip了
1)去到配置文件的目录
代码
$cd /etc/network
2)编辑interfaces此配置文件
代码
$sudo vi interfaces
如果是由dhcp自动配置本机ip的,interfaces的内容大概会是:
##lo配置
auto lo
iface lo inet loopback
##网卡eth0的配置
auto eth0
iface eth0 inet dhcp
我们需要配置多ip,所以修改interfaces文件成一下内容:
代码
##lo配置
auto lo
iface lo inet loopback
##虚拟出一个eth0:0
auto eth0
auto eth0:0
##配置eth0的ip,默认网关,子网掩码
iface eth0 inet static
address 192.168.1.23
gateway 192.168.1.1
netmask 255.255.0.0
##配置eth0:0的ip,默认网关,子网掩码
iface eth0:0 inet static
address 192.168.1.24
gateway 192.168.1.1
netmask 255.255.255.0
以上的是双ip的配置文件,
如果需要配置3个ip则是:
代码
##lo配置
auto lo
iface lo inet loopback
##虚拟出两个:eth0:0和eth0:1
auto eth0
auto eth0:0
auto eth0:1
##配置eth0的ip,默认网关,子网掩码
iface eth0 inet static
address 192.168.1.23
gateway 192.168.1.1
netmask 255.255.0.0
##配置eth0:0的ip,默认网关,子网掩码
iface eth0:0 inet static
address 192.168.1.24
gateway 192.168.1.1
netmask 255.255.255.0
##配置eth0:1的ip,默认网关,子网掩码
iface eth0:1 inet static
address 192.168.1.25
gateway 192.168.1.1
netmask 255.255.255.0
3)保存修改之后,重启一下网络服务
$sudo service networking restart
或者sudo /etc/init.d/networking restart
配置就生效了。
查看一下:
$ifconfig -a
环境:Ubuntu 8.10 server 64bit
Ubuntu的网卡配置文件是/etc/network/interfaces
修改一下这个配置文件就可以单网卡绑定两个ip,或者设置多个ip了
1)去到配置文件的目录
代码
$cd /etc/network
2)编辑interfaces此配置文件
代码
$sudo vi interfaces
如果是由dhcp自动配置本机ip的,interfaces的内容大概会是:
##lo配置
auto lo
iface lo inet loopback
##网卡eth0的配置
auto eth0
iface eth0 inet dhcp
我们需要配置多ip,所以修改interfaces文件成一下内容:
代码
##lo配置
auto lo
iface lo inet loopback
##虚拟出一个eth0:0
auto eth0
auto eth0:0
##配置eth0的ip,默认网关,子网掩码
iface eth0 inet static
address 192.168.1.23
gateway 192.168.1.1
netmask 255.255.0.0
##配置eth0:0的ip,默认网关,子网掩码
iface eth0:0 inet static
address 192.168.1.24
gateway 192.168.1.1
netmask 255.255.255.0
以上的是双ip的配置文件,
如果需要配置3个ip则是:
代码
##lo配置
auto lo
iface lo inet loopback
##虚拟出两个:eth0:0和eth0:1
auto eth0
auto eth0:0
auto eth0:1
##配置eth0的ip,默认网关,子网掩码
iface eth0 inet static
address 192.168.1.23
gateway 192.168.1.1
netmask 255.255.0.0
##配置eth0:0的ip,默认网关,子网掩码
iface eth0:0 inet static
address 192.168.1.24
gateway 192.168.1.1
netmask 255.255.255.0
##配置eth0:1的ip,默认网关,子网掩码
iface eth0:1 inet static
address 192.168.1.25
gateway 192.168.1.1
netmask 255.255.255.0
3)保存修改之后,重启一下网络服务
$sudo service networking restart
或者sudo /etc/init.d/networking restart
配置就生效了。
查看一下:
$ifconfig -a
阅读全文
0 0
- Linux下单网卡设置双ip,ubuntu设置双IP
- Linux下单网卡设置双ip,ubuntu设置双IP
- 单网卡设置双IP(ubuntu,debian)
- 给windows和ubuntu单网卡设置双ip…
- centos 和 ubuntu 下单网卡设置多个IP
- Linux操作系统单网卡双IP的设置
- Ubuntu单网卡设置多IP
- Ubuntu 10.10 单网卡多IP设置
- Linux服务器设置网卡IP与单网卡多IP
- Ubuntu网卡IP设置
- linux之设置单网卡多ip
- Ubuntu 网卡ip设置 ,dhcp , 自定义,双ip
- linux debian ubuntu 网卡ip地址设置
- linux设置IP网卡
- centos/rhel 6.2 单网卡em1:0设置双IP
- Centos系统的单网卡绑定双ip的设置
- linux IP地址网关设置和双网卡设置
- ubuntu下设置IP
- 响应式网站开发的干货
- Java复制文件的4种方式
- NFS原理安装配置
- 如何优雅地用TensorFlow预测时间序列:TFTS库详细教程
- C++ 继承与派生的访问性
- Linux下单网卡设置双ip,ubuntu设置双IP
- Function类型(重点)
- java设计模式之建造者模式
- Linux下redis的安装
- 读写文件Filestream
- ECMA6入门
- 两种方法让WordPress只在首页显示友情链接
- 倒计时84天
- Java中关于bit操作你必须要知道的事情