vim /etc/network/interfaces
[quote]
auto eth0
iface eth0 inet static
address 192.168.5.89
netmask 255.255.255.0
gateway 192.168.1.1
pre-up ifconfig eth0 hw ether 00:11:22:33:44:55 #修改mac地址
[/quote]
配置完重启:
#sudo /etc/init.d/networking restart
配置DNS
首先,你可以在/etc/hosts中加入一些主机名称和这些主机名称对应的IP地址,这是简单使用本机的静态查询.
要访问DNS 服务器来进行查询,需要设置/etc/resolv.conf文件.
假设DNS服务器的IP地址是192.168.3.2, 那么/etc/resolv.conf文件的内容应为:
search test.com
nameserver 192.168.3.2
设定第二个IP地址(虚拟IP地址)
编辑文件/etc/network/interfaces:
#sudo vi /etc/network/interfaces
在该文件中添加如下的行:
[quote]auto eth0:1
iface eth0:1 inet static
address 192.168.1.60
netmask 255.255.255.0
network x.x.x.x
broadcast x.x.x.x
gateway x.x.x.x[/quote]
根据你的情况填上所有诸如address,netmask,network,broadcast和gateways等信息.
用下面的命令使网络设置生效:
#sudo /etc/init.d/networking restart
[ubuntu] 配置ip
原创
©著作权归作者所有:来自51CTO博客作者mb63e0703549da8的原创作品,请联系作者获取转载授权,否则将追究法律责任
上一篇:[ubuntu] 配置vsftp
下一篇:Android 背景渐变色

提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
Ubuntu配置静态IP
1、静态IP配置;2、配置DNS;3、解决上网不能。
Ubuntu IP DNS 运维 -
Ubuntu 22单网卡配置多ip,多IP配置,Ubuntu单网卡如何配置多IP
具体操作:不管哪种配置, 都需要线确定要配置IP的网卡可以通过ip add 查看哪张网卡是激活在使用的我们整理可以看到,当前网卡是eno1 这块网卡1、临时配置配置网卡ifconfig eno1:0 192.168.1.139 netmask 255.255.255.0 upifconfig eno1:1 192.168.1.140 netmask 255.255.255.0 up输完后即立即生效,交换机并不会显示这两个ip但是可以ping通。
ubuntu ubuntu22 配置多IP 单网卡配置多IP Ubuntu配置多IP -
ubuntu配置静态IP地址
ubuntu静态IP配置方法: 编辑/etc/n
linux ubuntu 外网 -
Ubuntu下配置IP地址
1.编辑interfaces文件2.重新启动网络服务3.查看IP地址是否生效
IP 配置 Ubuntu -
Ubuntu 18.04配置静态ip
Ubuntu18.04配置静态iphttps://yunko.cn
Ubuntu 18.04配置静态ip