Gateway config eth0<->sl0

Discussion in 'Linux Networking' started by mds, Jan 4, 2015.

  1. mds

    mds Guest

    I am trying to set up host waikouaiti (debian "lenny", k2.2.26) as a
    gateway between the 192.168.1.0 and 192.168.2.0 subnets:

    -------
    [email protected]:~$ /sbin/ifconfig
    eth0 Link encap:Ethernet HWaddr 00:10:dc:f6:81:47
    inet addr:192.168.1.22 Bcast:192.168.1.255 Mask:255.255.255.0
    <snip>
    sl0 Link encap:VJ Serial Line IP
    inet addr:192.168.2.1 P-t-P:192.168.2.2 Mask:255.255.255.255

    [email protected]:~$ /sbin/route -n
    Kernel IP routing table
    Destination Gateway Genmask Flags Metric Ref Use
    Iface
    192.168.2.2 0.0.0.0 255.255.255.255 UH 0 0 0 sl0
    192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
    0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 eth0

    waikouaiti:/home/mds# route add 192.168.2.0
    SIOCADDRT: No such device <--- this is the problem
    -------

    Heres how I set up sl0:

    -------
    [email protected]:~$ cat /etc/rc2.d/S30alattach
    #!/bin/bash
    setserial -b dev/ttyS0 spd_vhi
    stty crtscts 115200 < /dev/ttyS0
    slattach -L -s 115200 /dev/ttyS0 &

    [email protected]:~$ cat /etc/rc.local
    <snip>
    # By default this script does nothing.

    ifconfig sl0 192.168.2.1 pointopoint 192.168.2.2
    -------

    I have rtfm'ed the NAG and the linux-2.2.26/Documentation/* and duck
    duck go'ed on this. Seems like I maybe have to rebuild the kernel with
    ip forwarding but it's unclear to me which menuconfig option that is.

    Please suggest how I can try to resolve this problem,

    Cheers, mds
     
    mds, Jan 4, 2015
    #1
    1. Advertisements

  2. mds

    Moe Trin Guest

    On Mon, 05 Jan 2015, in the Usenet newsgroup comp.os.linux.networking, in
    Jezz, that's a HORRIBLY ancient version of Debian. That kernel is
    over 10 years old.
    man route

    Note that this is a bit confusing - not only to me, but to the routing
    service on the kernel. You mention (below) the NAG. NORMALLY, the
    setup you show (host 192.168.2.2 directly via sl0) would suffice. If
    there are hosts _beyond_ 192.168.2.2 (perhaps another /24 on a separate
    local network), I'd have them using a different network range from the
    point-to-point link - such as 192.168.3.0/24, and the routing table you
    show on this end of the link would look like

    192.168.3.0 192.168.2.2 255.255.255.0 UG 0 0 0 sl0
    which says to send packets destined for 192.168.3.0 via the "router"
    (or gateway) at 192.168.2.2. Hosts on the 192.168.3.x net would
    have a routing table that looks something like (assumes Ethernets for
    local connectivity)

    192.168.3.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
    0.0.0.0 192.168.3.1 0.0.0.0 UG 0 0 0 eth0

    Which says 192.168.3.0 is local, and ANYTHING ELSE should be sent to
    192.168.3.1 (the local address of the other end of the serial link)
    for forwarding - BUT that assumes that what-ever device is
    192.168.2.2/192.168.3.1 will forward packets received over the serial
    link to the network on it's other interface (and vice-versa).
    I think you are mis-interpreting the routing table. Try re-reading
    the chapter on "gateways" in the NAG, then "man route" and look at the
    -gw (gateway) variable.

    Old guy
     
    Moe Trin, Jan 5, 2015
    #2
    1. Advertisements

  3. mds

    Moe Trin Guest

    "]
    I am trying to set up host waikouaiti (debian "lenny", k2.2.26) as a
    gateway between the 192.168.1.0 and 192.168.2.0 subnets:[/QUOTE]
    Note - point to point (host) route
    and this is reflected in the routing table
    and the kernel replies "I don't know how to get there"

    You could change that to

    /sbin/route add -net 192.168.2.0 netmask 255.255.255.0 -gw
    192.168.2.2

    which would add a network route using 192.168.2.2 as a gateway

    192.168.2.0 192.168.2.2 255.255.255.0 UG 0 0 0 sl0
    which is still somewhat confusing, but will work because the Host route
    to 192.168.2.2 takes precedence over the network route to 192.168.2.0
    because it's more precise (single host compared to a network). This is
    the same line of thinking that allows traffic to use the serial-link
    rather than sending traffic to 192.168.1.1 for forwarding (because
    0.0.0.0 with a mask of 0.0.0.0 means "everything" IPv4). Mentioned in
    my earlier reply, if there were any hosts hanging off a separate
    network interface on 192.168.2.2, I'd suggest using a different address
    range for them - such as 192.168.3.x.
    On _this_ host - forwarding would be needed for routing traffic between
    the world (reachable via 192.168.1.1) and any other hosts on the
    192.168.1.0 network and any host reachable via the serial link. On the
    other end of the serial link, that host would also have to be forwarding
    if there are hosts on a network card using an address OTHER THAN
    192.168.2.1 and 192.168.2.2. It's been a LONG time since I used a 2.2.x
    kernel, but I think that was done by

    echo 1 > /proc/sys/net/ipv4/ip_forward

    I've basically forgotten how to set up the 2.2.x firewall which is
    IPCHAINS rather than the "iptables" tool introduced with the 2.4.x
    kernel. Rusty Russel's 'netfilter.org' server may have enough data
    to help - try "http://www.netfilter.org/documentation/HOWTO/", or
    locate a copy of the "Security-Quickstart-HOWTO" at any LDP mirror.
    Any particular reason you need to be using such an old release? Wheezy
    has been out for nearly two years, and should be replaced by jessie in
    the next month or three.

    Old guy
     
    Moe Trin, Jan 5, 2015
    #3
  4. mds

    mds Guest

    I have a brother HL5350DN printer connected to that machine. The printer
    dates from the time of lenny and brother haven't kept the support up to
    date with subsequent releases. It'd be possible to make the printer work
    with wheezy but I just can't be bothered looking in to it at the moment.
    The machine running lenny has a serial port so it's other job is to
    connect to a near antique toshiba 100cs laptop. To transfer a file from
    my modern pc to the toshiba I have to scp it to the lenny box, ssh into
    the lenny box and scp it to the toshiba.

    Anyway thanks for your suggestions I'm sure I can make some headway with
    this now by following up on them.
     
    mds, Jan 6, 2015
    #4
  5. mds

    Moe Trin Guest

    On Tue, 06 Jan 2015, in the Usenet newsgroup comp.os.linux.networking, in
    Good reason - I'd suggest waiting a couple of weeks anyway until jessie
    comes out.
    OK - 'lenny' needs to be told to forward packets - that should only take
    the "echo 1 > /proc/sys/net/ipv4/ip_forward" line, perhaps in the
    script that brings up the serial link. The routing table in your
    original post (host, Ethernet and default) is fine for 'lenny'. The
    'toshiba' needs to have the routing table look something like

    192.168.2.1 0.0.0.0 255.255.255.255 UH 0 0 0 sl0
    192.168.1.0 192.168.2.1 255.255.255.0 UG 0 0 0 sl0

    which tells it 'lenny' is reachable on the serial link, and that there
    is a network beyond it reachable using 'lenny' as a gateway. You
    could just tell 'toshiba' that 'lenny' is the default route, which
    would have the same result. The 'modern pc' box has Ethernet I
    assume, so it (and any other hosts on the 192.168.1.0 Ethernet) needs
    a routing table that has

    192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
    192.168.2.2 192.168.1.22 255.255.255.255 UH 0 0 0 eth0

    which tells it that 'toshiba' can be reached by sending the packets to
    'lenny' (the eth0 interface). The syntax would likely be

    /sbin/route add -host 192.168.2.2 gw 192.168.1.22
    You're welcome!
    I imagine trying to find an Ethernet adapter for the Toshiba would be a
    major problem. In the late 1990s, I recovered an Acer laptop that had
    been tossed out with an intermittent display, but it had a serial port
    and Ethernet dongle. It became my dial-out firewall box - setting in
    the closet in a cardboard box along with a 28.8k external modem. "The
    price was right".

    Old guy
     
    Moe Trin, Jan 7, 2015
    #5
  6. mds

    mds Guest

    'toshiba':/home/mds# route add -net 192.168.1.0 gw 192.168.2.1 sl0
    SIOCADDRT: Invalid argument
    toshiba:/home/mds# route add default gw 192.168.2.1
    toshiba:/home/mds#

    The 'modern pc' box has Ethernet I
    Done and yes now it works:

    'toshiba':/home/mds# ping 192.168.1.11
    PING 192.168.1.11 (192.168.1.11): 56 data bytes
    64 bytes from 192.168.1.11: icmp_seq=0 ttl=63 time=42.0 ms

    'modern':~$ ping 192.168.2.2
    PING 192.168.2.2 (192.168.2.2) 56(84) bytes of data.
    64 bytes from 192.168.2.2: icmp_req=1 ttl=254 time=28.0 ms

    Thanks this is way more convenient now.
    Cool. I have a thing for retro gear. Might be getting an 8088 olivetti
    laptop this week. It can go on the network too if there is tcp/ip for
    ancient dos.
     
    mds, Jan 10, 2015
    #6
  7. mds

    Moe Trin Guest

    On Sun, 11 Jan 2015, in the Usenet newsgroup comp.os.linux.networking, in
    Needs to know how big the network is - try "route add -net 192.168.1.0
    netmask 255.255.255.0 gw 192.168.2.1". As the default route worked, no
    matter.

    That was a 386SX-20 max'ed out with 16 Mb of RAM.
    Depending how ancient, it may have existed. The Usenet newsgroup
    "comp.protocols.tcp-ip.ibmpc" is probably long dormant (nearly all of
    the articles I see there now are google-spam), but in the early-1990s,
    that was where John Levine (in the book "Internet for Dummies") was
    directing people. Most of the software I remember (and the items
    Levine listed in the reference section of that book) required a minimum
    of windoze 3.1 which implied a 80286 or better. Never mind the little
    problem of where you're going to find usable copies of PCTCP, Chameleon,
    BW, or SuperTCP. NCSATelnet? Nah, you're likely going to be limited
    to a serial terminal program like BitCOM, PC-Com, PCModem, ProComm or
    QModem talking to a terminal server like *getty. I don't recall if
    ELKS (Embeddable Linux Kernel Subset) would work on an 8088 (it should),
    what networking capability it had, or where you could find it now.

    Old guy
     
    Moe Trin, Jan 11, 2015
    #7
    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.