星期二, 1月 01, 2013

Linux 暫時設定 ip 與 gateway 的方法

Linux 暫時設定 ip 與 gateway 的方法

設定 eth0 的 ip, broadcast, netmask:
ifconfig eth0 192.168.1.100 broadcast 192.168.1.255 netmask 255.255.255.0

設定預設 gateway (砍掉舊的加新的):
route del default
route add default gw 192.168.1.1

沒效果的話可以重新啟動與關畢網路:
ip link show eth0
ip link set eth0 up
ip link set eth0 down

沒有留言: