ubuntu系统添加ip

默认情况下,我们买服务器都会给我们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

可能会遇到的错误

/etc/init.d/networking restart错误分析案例:[email protected]www.ctohome.com:/etc/network# /etc/init.d/networking restart * Reconfiguring network interfaces.../etc/network/interfaces:165: interface eth0:28 declared allow-auto twiceifdown: couldn‘t read interfaces file "/etc/network/interfaces"/etc/network/interfaces:165: interface eth0:28 declared allow-auto twiceifup: couldn‘t read interfaces file "/etc/network/interfaces"   ...fail!

说明eth0:28有重复,解决办法:vi interfaces找到eth0:28,删除掉重复的

[email protected]www.ctohome.com:/etc/network# /etc/init.d/networking restart * Reconfiguring network interfaces.../etc/network/interfaces:166: duplicate interfaceifdown: couldn‘t read interfaces file "/etc/network/interfaces"/etc/network/interfaces:166: duplicate interfaceifup: couldn‘t read interfaces file "/etc/network/interfaces"   ...fail!

说明166行有重复,解决办法:vi interfaces找到166行(set number),删除掉重复的

[email protected]www.ctohome.com:/etc/network# /etc/init.d/networking restart * Reconfiguring network interfaces.../etc/network/interfaces:162: duplicate interfaceifdown: couldn‘t read interfaces file "/etc/network/interfaces"/etc/network/interfaces:162: duplicate interfaceifup: couldn‘t read interfaces file "/etc/network/interfaces"

说明162行有重复,解决办法:vi interfaces找到166行(set number),删除掉重复的
时间: 2024-07-31 19:05:59

ubuntu系统添加ip的相关文章

ubuntu批量添加IP

ubuntu 批量添加ip脚本 # !/bin/bash for ((i=0;i<=3;i=i+1)) do echo "auto eth0:$i">>/etc/network/interfaces echo "iface eth0:$i inet static">>/etc/network/interfaces let j=$i+179 echo "address 45.41.89.$j">>/etc/

基于MT7688模块的开发笔记7——给Ubuntu系统添加samba服务

有的Ubuntu系统不能通过虚拟机的文件夹共享功能实现Windows与Ubuntu之间的文件共享,可以通过安装samba实现这个功能,主要步骤如下,供参考.经过测试,我的Ubuntu12.4.2系统已经可以实现在Windows下访问Ubuntu系统中的文件夹,当然Ubuntu12.4.2是可以通过虚拟机共享功能访问Windows中文件夹.有了这个功能后,就可以将Ubuntu中编译的文件共享到Windows. 一.更新源 [email protected]:~$ su Password: [ema

Ubuntu系统添加搜狗输入法

前端开发时有时候要接触到Ubuntu系统,但由于本身没有拼音输入,故需要自己安装搜狗,记录方法如下: 1.升级并安装输入法依赖包: $sudo apt-get update $sudo apt-get install fcitx libssh2-1 2.查看是否已经安装依赖包 $dpkg -l|grep fcitx $dpkg -l|grep libssg 3.下载输入法:http://pinyin.sogou.com/linux/?r=pinyin(64位或者32位) 4.双击下载包文件.de

debian/ubuntu系统,IP DNS MTU 配置

1.配置添加IP:vi /etc/network/interfaces   修改如下内容 # The primary network interface auto eth0 iface eth0 inet static mtu 1410 address 192.168.1.100 address2                                    #添加多个IP地址 netmask 255.255.255.0 gateway 192.168.1.1 保存,重启网卡 servi

ubuntu系统添加环境变量的方法(转)

1.Ubuntu专有方式编辑 /etc/ld.so.conf 文件,如果以下语句不存在,则加入:include /etc/ld.so.conf.d/*.conf然后在/etc/ld.so.conf.d下边新建一个以 .conf 结尾的文件.在新建的 .conf 文件中写入需要设置的 path,例如:~/mypath/bin 2.用户目录下的 .bashrc 文件在用户主目录下,有一个 .bashrc 文件,编辑该文件:$gedit ~/.bashrc 在最后边加入需要设置变量的shell语句,例

Ubuntu系统的IP配置

用过ubuntu的人都知道,刚安装好系统root用户是没有密码的,没有密码我们就没法用root用户登录,给root用户设置密码输入命令 sudo passwd,然后系统会让你输入密码,这时输入的密码就是root用户的密码了,设置完成之后就可以切换root用户登录了,如图: 1.给root设置密码,输入下列命令: sudo passwd [email protected]:~# vi /etc/network/interfaces #This file describes the network

Ubuntu系统添加用户权限

一.首先创建一个新用户: sudo adduser hadoop 其次设置密码: sudo passwd hadoop 如果无法使用root密码,请输入如下命令: sudo passwd root 二.更改用户权限sudo, 更改/etc/sudosers文件 cd /etc sudo vim /etc/sudosers 添加 hadoop ALL=(ALL:ALL) ALL 三.删除用户 sudo userdel -r hadooop 原文地址:https://www.cnblogs.com/

VMware 虚拟机 Ubuntu 系统执行 ifconfig 命令 eth0没有IP地址(intet addr、Bcast、Mask) 解决:UP BROADCAST MULTICAST 问题

VMware 虚拟机 ifconfig没有net_addr地址.Bcast.Mask的解决方法 使用时间长的虚拟机,会莫名其妙的连接不上网 在终端中,使用ifconfig命令查看Ubuntu系统的IP地址,发现没有分配IP地址. eth0:网络接口 link encap : 网络类型 HWaddr : 网卡物理地址 Inet addr :(internet address) IP地址 Bcast:广播地址 Mask:子网掩码 UP:正在使用的网络接口 RX packets,TX packets 

windows系统如何通过Xshell 客户端连接 linux系统(主要介绍ubuntu系统)

一. 1.查看ubuntu系统的ip地址:ifconfig 在window系统运行窗口下:ping ubuntu系统的IP地址:例如:ping 192.168.163.129 出现下述命令就是ping通了,按CTRL+C结束 2.再来查看windows系统的ip地址:ipconfig win+R  输入cmd(或者点击运行) 在Linux系统运行窗口下:ping windows系统的IP地址:例如:ping 192.168.20.56 出现下述命令就是ping通了,按CTRL+C结束 现在,双方