우분투 기본 게이트웨이 변경

리눅스 기본 게이트웨어 변경
/etc/sysconfig/network

1 영구 적용[ | ]

  • 재부팅 후에도 적용됨
root@zetawiki:~# vi /etc/network/interfaces
auto lo
iface lo inet loopback

auto eth1
iface eth1 inet dhcp
post-up route add default gw 192.168.0.1
root@zetawiki:~# ifdown eth1 && ifup eth1
Internet Systems Consortium DHCP Client 4.2.4
... (생략)
root@zetawiki:~# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.0.1     0.0.0.0         UG    0      0        0 eth1

2 임시 적용[ | ]

  • 재부팅하면 사라짐
  • 임시적용은 CentOS와 동일함
명령어
route add default gw 게이트웨이주소 장치명
실행예시
root@zetawiki:~# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.0.0     *               255.255.255.0   U     1      0        0 eth1
default         192.168.0.1     0.0.0.0         UG    0      0        0 eth1
root@zetawiki:~# route add default gw 192.168.0.2 eth1
root@zetawiki:~# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.0.0     *               255.255.255.0   U     1      0        0 eth1
default         192.168.0.2     0.0.0.0         UG    0      0        0 eth1
→ default 게이트웨이를 변경하면 네트워크가 안될 수도 있으니 주의!

3 같이 보기[ | ]

4 참고[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}