For Debian Linux
# dhcp auto eth0 iface eth0 inet dhcp # static auto eth0 iface eth0 inet static address 10.16.3.99 netmask 255.255.255.0 network 10.16.3.0 broadcast 10.16.3.255 gateway 10.16.3.1 /etc/init.d/networking restart
For Redhat Linux
临时修改网卡IP ifconfig eth0 172..16.0.5/16 up 添加网关 route add default gw 172.16.0.111 临时修改默认的DNS vim /etc/resolv.conf vim /etc/sysconfig/network-scripts/ifcfg-eth1 DEVICE=eth1 HWADDR=00:0C:29:36:**:** TYPE=Ethernet UUID=7eaffa26-ee97-4d23-a333-a84da8341*** ONBOOT=yes NM_CONTROLLED=yes BOOTPROTO=static IPADDR=172.16.0.103 NETMASK=255.255.255.0 GATEWAY=172.16.0.111 DNS1=114.114.114.114 DNS2=8.8.8.8
时间: 2024-10-05 23:36:19