首页 > 编程知识 正文

ubuntu 配置静态IP地址,路由器配置静态地址linux

时间:2023-05-06 05:21:27 阅读:253592 作者:1280

首先在shell 下:查看ip地址

ifconfig 或者 ip address

可以看到本地网络适配器是:enp0s31f6

其次,修改/etc/network/interfaces 内容编辑器是vim or gedit 都是ok,

sudo vim /etc/network/interfaces 原本里面是这些

# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback

添加以下(其中红色的都是根据自己的需求)


auto enp0s31f6
iface enp0s31f6 inet static
address 192.168.2.56
netmask 255.255.255.0
gateway 192.168.2.1
iface enp0s31f6 inet6 auto
dns-nameserver 8.8.8.8

 

最后,重新启动网络:
 

sudo /etc/init.d/networking restart或者sudo ifdown enp0s31f6 & sudo ifup enp0s31f6

 

以上完成是ok 的

 

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。