LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   static routes (https://www.linuxquestions.org/questions/linux-newbie-8/static-routes-823948/)

fdelval 08-03-2010 05:34 PM

static routes
 
Hello, i have an ubuntu server which im configuring as router.


In one interface i have internet, and in the other one i have LAN, and it works ok, i can surf the net, set up a server etc etc

Now i have a curiosity, my lan is 192.168.1.0 in eth0

Can i add a pc in that lan with ip: 192.168.111.111 (note different subnet) and add a route policy like: route add gw 192.168.111.0 through eth0 ???

If thats not possible, what are static routes for? any practical example??

lartman 08-03-2010 08:03 PM

route add 192.168.111.111 eth0
sets up a host route. There is no need for a gateway as localhost is the router.

route add -net 192.168.111.0 netmask 255.255.255.0 eth0
does the subnet.

The simpler way is to assign 192.168.111.1 to eth0 as a second address and let the route be implied.


All times are GMT -5. The time now is 06:57 AM.