- 리눅스 기본 게이트웨어 변경
- /etc/sysconfig/network
1 영구 적용[ | ]
- 재부팅 후에도 적용됨
Console
Copy
root@zetawiki:~# vi /etc/network/interfaces
aconf
Copy
auto lo
iface lo inet loopback
auto eth1
iface eth1 inet dhcp
post-up route add default gw 192.168.0.1
Console
Copy
root@zetawiki:~# ifdown eth1 && ifup eth1
Internet Systems Consortium DHCP Client 4.2.4
... (생략)
Console
Copy
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와 동일함
- 명령어
Bash
Copy
route add default gw 게이트웨이주소 장치명
- 실행예시
Console
Copy
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 참고[ | ]
편집자 Jmnote Jmnote bot
로그인하시면 댓글을 쓸 수 있습니다.
- 분류 댓글:
- 리눅스 네트워크 (5)
리눅스 hosts 파일 ― 올해대박리눅스 hosts 파일 ― Jmnote리눅스 nc 포트 열기 ― …우분투 절전모드 해제시 와이파이 안되는 문제 ― D4RT우분투 절전모드 해제시 와이파이 안되는 문제 ― Beyondthelimit