失眠网,内容丰富有趣,生活中的好帮手!
失眠网 > ubuntu设置网卡默认启动_Ubuntu配置网卡IP地址

ubuntu设置网卡默认启动_Ubuntu配置网卡IP地址

时间:2024-04-28 04:58:11

相关推荐

ubuntu设置网卡默认启动_Ubuntu配置网卡IP地址

Ubuntu Desktop14.04 ,在window7 下的vmware14虚拟机中

cat /etc/network/interfaces

默认已经有lo: 系统给定的网络回环接口

eth0的配置(Ubuntu Desktop14.04)

1. cd /etc/network

vim interfaces

2. 键入如下命令:

auto eth0

iface eth0 inet static

address 192.168.1.1

netmask 255.255.255.0

network 192.168.1.0

gateway 192.168.1.254

broadcast 192.168.1.255

3. 添加另一块网卡eth1

auto eth1

iface eth1 inet static

address 192.168.1.10

netmask 255.255.255.0

network 192.168.1.0

gateway 192.168.1.254

broadcast 192.168.1.255

:wq 存盘退出

4. 重新启动网络服务:

sudo /etc/init.d/networking restart

5. 使eth1生效,激活eth1

ifup eth1

6. 开启网内的访问权限:

sudo ufw allow from 192.168.1.250/24

说明:192.168.1.250为另一台ubuntu server 16.04的IP地址

7. 切换到ubuntu server 16.04虚拟机上,输入命令:

sudo ufw allow from 192.168.1.10/24

说明:192.168.1.10是ubuntu desktop上刚添加的网卡eth1的IP地址

8. 两台虚拟机均重新启动

9. 从ubuntu server服务器ping 客户端ubuntu desktop

ping 192.168.1.10 连通

从ubuntu desktop客户端ping 服务器ubuntu server

ping 192.168.1.250. 连通

10. 修改客户端ubuntu desktop的eth0的IP地址:

ifconfig eth0 192.168.1.100 netmask 255.255.255.0

再看一下是否被修改

ifconfig -a

11. 使修改后的IP地址生效:

ifconfig eth0 up

互相ping 仍然可以ping通

如果觉得《ubuntu设置网卡默认启动_Ubuntu配置网卡IP地址》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。