自学内容网 自学内容网

debian 12配置固定ip

配置文件

cat /etc/network/interfaces |grep -v #

source /etc/network/interfaces.d/*

auto lo
iface lo inet loopback

allow-hotplug ens18
iface ens18 inet static
        address 192.168.0.105/24
        network 192.168.0.0
        broadcast 192.168.0.255
        gateway 192.168.0.1
        dns-nameservers 8.8.8.8

nmtui命令设置:

sudo apt -y install network-manager
nmtui

重启网卡使其生效:

/etc/init.d/networking restart

查看结果

  • ip addr show

  • 如果网络接口已配置为静态IP地址,则在输出中会看到以下内容(没有dynamic):

inet <静态IP地址>/<子网掩码> brd <广播地址> scope global <网络接口名称>
  • 如果网络接口已配置为动态IP地址,则在输出中会看到以下内容(有dynamic):
inet <动态IP地址>/<子网掩码> brd <广播地址> scope global dynamic <网络接口名称>

原文地址:https://blog.csdn.net/Jon_c/article/details/142481683

免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!