How To Set Gateway In Linux?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
To set a gateway in Linux, you can use the ip route command to set a default gateway to direct all traffic not addressed to a destination on the local network. The command will be:
$ sudo ip route add default via [Gateway_IP] dev [Network_device]
Replace [Gateway_IP] with the IP address of the gateway, and [Network_device] with the name of the network device (e.g. eth0). For example:
$ sudo ip route add default via 192.168.1.1 dev eth0