Linux setup default gateway with route command

วันนี้มีปัญหาว่าไอ้เครื่อง Server ที่ผมดูอยู่มัน ping ไปบาง network ที่ต้องการไม่ได้ ผมจึงลองใช้ command route ดูปรากฏว่ามัน ชี้ default gateway ไปอีก ip ก็เลยต้องทำการ change default gateway ให้มันใหม่ โดยใช้ command ดังนี้

# route add default gw 172.16.1.1 eth0

แล้วก็ลอง พิมพ์ route command ดูอีกทีมันก็จะเปลี่ยนให้ครับ… จบ

ขอเพิ่มอีกนิดครับ… มีอีกคำสั่งในการเพิ่ม route ให้กับ network ครับ ดังนี้

# ip route add 172.16.2.0/24 via 172.16.1.1

ตรง 172.16.1.1 ก็เป็น Gateway ที่เราอยากให้ IP กลุ่ม 172.16.2.0/24 วิ่งผ่าน

จบแต้ๆ..เจ้า

Related Posts

  • No Related Post

Leave a Reply

Your email address will not be published. Required fields are marked *

*

*


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">