knowledge/linux/ubuntu配静态IP.md
2021-11-25 15:51:36 +08:00

498 B
Raw Blame History

为ubuntu系统配置静态ip地址


如果使用非root用户需要在命令前加sudo

ubuntu 16.04

vim /etc/network/interfaces

只修改eth0部分或者是别的网卡名

auto eth0
iface eth0 inet static
    address 183.211.245.49
    netmask 255.255.255.128
    broadcast 183.211.245.127
    gateway 183.211.245.1
    dns-nameservers 221.131.143.69

如果想用dhcp自动获取ip的话照下面改

auto eth0
iface eth0 inet dhcp