route and static route to a gateway

Discussion in 'Linux Networking' started by Sting, Feb 19, 2004.

  1. Sting

    Sting Guest

    from man route:
    gw GW route packets via a gateway. NOTE: The specified gateway must
    be reachable first. This usually means that you have to set up a
    static route to the gateway beforehand.

    What is static route to the gateway ?
    How do you set it ?

    Sting, Feb 19, 2004
    1. Advertisements

  2. Sting

    MM Guest

    If your gw isn't connected directly to you you must specify with route
    program itself what other machine are from you to gw. If a direct
    connection exists you don't do anything.
    MM, Feb 19, 2004
    1. Advertisements

  3. It depends whether the gateway is already defined in a route for that
    interface (like a local network route). If not, you would typically set a
    -host route to gateway IP before using it as a default route. With things
    like ppp or pppoe, a route to the gateway (remote ppp IP) is usually
    automatic and defaultroute option would set the default route.

    It is usually only a concern when doing some sort of special static
    networking, like using an IP from 1 network on another interface. For

    Router- network
    where eth0 netmask
    eth1 netmask

    In this case bringing up eth1 from scripts would usually automatically set
    a local router on eth1 for network, but eth0
    would have no route. So somewhere you would need to:

    route add -host dev eth0
    route add default dev eth0

    However, for the router set for netmask to
    see the rest of that network without having a gateway set for it, besides
    enabling ip_forward, proxy arp would have to be enabled for eth0:

    echo 1 > /proc/sys/net/ipv4/conf/eth0/proxy_arp

    Then eth0 would answer arp requests from the router for any IPs on eth1.
    David Efflandt, Feb 21, 2004
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.