ubuntu系统添加ip
2015-07-31 11:03
435 查看
默认情况下,我们买服务器都会给我们5个以上的ip,一般主机都对应一个主ip,如果想把4个剩余ip加到主机上,需要手动配置,具体操作是
打开vim /etc/network/interfaces
默认是
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 8.8.8.8(根据自己的ip)
netmask 255.255.255.248
gateway 8.8.8.8(根据自己的getway)
要再添加就加上
auto eth0:1
iface eth0:1 inet static
address 8.8.8.8(根据自己的ip)
netmask 255.255.255.248
gateway 8.8.8.8(根据自己的getway)
auto eth0:2
iface eth0:2 inet static
address 8.8.8.8(根据自己的ip)
netmask 255.255.255.248
gateway 8.8.8.8(根据自己的getway)
以此类推
加完后保存,重启
/etc/init.d/networking restart
ok
可能会遇到的错误
打开vim /etc/network/interfaces
默认是
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 8.8.8.8(根据自己的ip)
netmask 255.255.255.248
gateway 8.8.8.8(根据自己的getway)
要再添加就加上
auto eth0:1
iface eth0:1 inet static
address 8.8.8.8(根据自己的ip)
netmask 255.255.255.248
gateway 8.8.8.8(根据自己的getway)
auto eth0:2
iface eth0:2 inet static
address 8.8.8.8(根据自己的ip)
netmask 255.255.255.248
gateway 8.8.8.8(根据自己的getway)
以此类推
加完后保存,重启
/etc/init.d/networking restart
ok
可能会遇到的错误
/etc/init.d/networking restart错误分析案例: root@www.ctohome.com:/etc/network# /etc/init.d/networking restart * Reconfiguring network interfaces... /etc/network/interfaces:165: interface eth0:28 declared allow-auto twice ifdown: couldn't read interfaces file "/etc/network/interfaces" /etc/network/interfaces:165: interface eth0:28 declared allow-auto twice ifup: couldn't read interfaces file "/etc/network/interfaces" ...fail! 说明eth0:28有重复,解决办法:vi interfaces找到eth0:28,删除掉重复的 root@www.ctohome.com:/etc/network# /etc/init.d/networking restart * Reconfiguring network interfaces... /etc/network/interfaces:166: duplicate interface ifdown: couldn't read interfaces file "/etc/network/interfaces" /etc/network/interfaces:166: duplicate interface ifup: couldn't read interfaces file "/etc/network/interfaces" ...fail! 说明166行有重复,解决办法:vi interfaces找到166行(set number),删除掉重复的 root@www.ctohome.com:/etc/network# /etc/init.d/networking restart * Reconfiguring network interfaces... /etc/network/interfaces:162: duplicate interface ifdown: couldn't read interfaces file "/etc/network/interfaces" /etc/network/interfaces:162: duplicate interface ifup: couldn't read interfaces file "/etc/network/interfaces" 说明162行有重复,解决办法:vi interfaces找到166行(set number),删除掉重复的
相关文章推荐
- Java多线程2--线程控制
- CSV 数字转化文本
- Hbase数据导入导出
- leetcode 073 —— Set Matrix Zeroes
- 嵌入式驱动实习生试题(答案)
- [leetcode-39]Combination Sum(java)
- 喷水装置(一)【贪心】
- OI你好
- Windows 远程桌面访问CentOS6.5(XRDP方式)
- 什么是HMVC
- Hadoop-eclipse-plugin插件安装
- 关于手机号码、邮箱的在JavaScript中的正则表达式和其简单用法
- AMBA片上总线在基于IP复用的SoC设计中的应用
- 菜鸟教程之工具使用(十九)——国际化资源文件开发凶器MultiProperties
- LOV抛出值无效的异常
- NavigationControllerr滑动返回
- 基于opencv的特征点匹配法
- 一阶谓词逻辑系统的一个扩充
- C:结构体
- 理解javascript中的原型和原型链