Debian配置静态ip
网卡配置
配置文件路径: /etc/network/interfaces
source /etc/network/interfaces.d/*
# the loopback network interface
auto lo
iface lo inet loopback
# the primary network interface
allow-hotplug eth0
iface eth0 inet dhcp
将对应网卡默认的 dhcp
修改为 static
,举例如下:
# the primary network interface
allow-hotplug eth0
#iface eth0 inet dhcp
iface eth0 inet static
address 192.168.1.110
netmask 255.255.255.0
gateway 192.168.1.1
DNS 配置
DNS 配置文件位置: /etc/resolv.conf
将 dns 配置文件中 nameserver
改为对应的局域网网关即可
网络重启
- 重启网卡命令
/etc/init.d/networking restart