Linux网络配置(debian)
1.设置IP地址、网关等
vi /etc/network/interfaces
# The primary network interface
auto eth0 # 开机自动连接网络
allow-hotplug eth0
iface eth0 inet static # static表示使用固定ip,dhcp表述使用动态ip
address 192.168.21.166 # 设置ip地址
netmask 255.255.255.0 # 设置子网掩码
gateway 192.168.21.2 # 设置网关
2.设置DNS
vi /etc/resolv.conf
# 添加:
nameserver [dns的ip地址]
3重启网卡
service networking restart