Debian12配置静态IP

方法1

rambo@test3:~$ sudo vim /etc/network/interfaces          # 追加如下内容
....
    ....
auto ens33
iface ens33 inet static
address 172.16.186.133
netmask 255.255.255.0
gateway 172.16.186.2
dns-nameservers 172.16.186.2


rambo@test3:~$ sudo systemctl restart networking.service

方法2

rambo@test2:~$ sudo vim /etc/network/interfaces.d/ens33
auto ens33
iface ens33 inet static
address 172.16.186.132
netmask 255.255.255.0
gateway 172.16.186.2
dns-nameservers 172.16.186.2


rambo@test2:~$ sudo systemctl restart networking.service

posted @ 2023-10-22 21:51  Linux大魔王  阅读(1681)  评论(0编辑  收藏  举报