Ubuntu网络IP设置

论坛 期权论坛 脚本     
匿名技术用户   2021-1-5 10:15   11   0

今天在虚拟机上安了个Ubuntu ,默认是动态IP,/etc/network/interfaces配置是

auto lo iface lo inet lookup

1.如果要使用DHCP动态获取则为:

sudo vi /etc/network/interfaces : auto eth0 iface eth0 inet dhcp

保存,退出VI;

2.如果要使用静态IP,则设置:

sudo vi /etc/network/interfaces : auto eth0 # iface eth0 inet dhcp iface eht0 inet static

address 192.168.1.254 netmask 255.255.255.0 gateway 192.168.1.1 nameserver 192.168.1.1

保存,退出VI

使用sudo /etc/init.d/networking restart 或sudo ifdown eth0关闭网络,sudo ifup eth0打开网络,重启网卡。

分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:7942463
帖子:1588486
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP