Find the answer to your Linux question:
Results 1 to 10 of 10
Hi, I have a linux box with 2 nic installed: ATH0 connects to my local wireless network. ETH0 connects to a modem which is connected to the external world. (Modem ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    May 2009
    Posts
    72

    Using ssh with multiple nic


    Hi,

    I have a linux box with 2 nic installed:

    ATH0 connects to my local wireless network.
    ETH0 connects to a modem which is connected to the external world. (Modem has a static ip address).

    I configured my routing so that the default gateway points to my local wireless network. Doing so prevents me from connecting to my box using ssh and the modem static ip address.

    If I configure my routing to use the modem as the default gateway then I can ssh into it fine. I can actually ssh into it using both nic with that configuration.

    But I need my traffic to go through the wireless network, therefore is there any way to ssh into my box through the modem without it being configured as the default gateway?

  2. #2
    Linux Engineer Kloschüssel's Avatar
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    773
    Normally, the routing would decide which hardware is used to send information. I vaguely guess that there's something messed with how you designed your network? Could you post a more detailed description of your network containing computers, their subnets and routing configuration?

  3. #3
    Just Joined!
    Join Date
    May 2009
    Posts
    72
    my interfaces file looks like this:

    auto lo
    iface lo inet loopback

    auto ath0
    iface ath0 inet dhcp
    madwifi-base wifi0
    wireless-mode Managed
    up iwconfig ath0 essid XXXXXXXX
    up iwconfig ath0 txpower auto
    up iwconfig ath0 enc off
    up iwconfig ath0 rate auto
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

    auto eth0
    iface eth0 inet dhcp
    up route del -net default


    ifconfig:
    ath0: 192.1.2.123
    eth0: 184.1.2.234


    route:

    Kernel IP routing table
    Destination Gateway Genmask Flags Metric Ref Use Iface
    192.1.2.0 * 255.255.255.0 U 0 0 0 ath0
    184.1.2.0 * 255.255.255.0 U 0 0 0 eth0
    default 192.1.2.1 0.0.0.0 UG 0 0 0 ath0

    The windows PC I'm using to ssh to the linux box is on the same subnet 192.1.2.0.

  4. $spacer_open
    $spacer_close
  5. #4
    Linux Engineer Kloschüssel's Avatar
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    773
    ifconfig:
    ath0: 192.1.2.123
    eth0: 184.1.2.234
    Could the first byte of the ip address assigned to eth0 be the problem? Please note also that 184.1.2.0/24 is not a valid subnet for private use. There are only a few as mentioned in http://www.ietf.org/rfc/rfc1918.txt. The private address space are three subnets, namely:

    10.0.0.0 - 10.255.255.255 (10/8 prefix)
    172.16.0.0 - 172.31.255.255 (172.16/12 prefix)
    192.168.0.0 - 192.168.255.255 (192.168/16 prefix)
    Cheers

  6. #5
    Just Joined!
    Join Date
    May 2009
    Posts
    72
    I don't think so, it's an external static ip address given by my internet provider accessible from anywhere.

  7. #6
    Linux Engineer Kloschüssel's Avatar
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    773
    Strange indeed. I've not understood yet how your network is set up. Could you please describe where your computer is (ip/subnet), your "box" that you are ssh'ing into (ip/subnet) and your router (ip/subnet) and all routing devices in between?

  8. #7
    Just Joined!
    Join Date
    May 2009
    Posts
    72
    My windows pc is located inside an office.
    Ip address is 192.1.2.119
    Subnet 192.1.2.
    Default gateway 192.1.2.1

    The linux box has 2 nic:
    Ath0 connected to the same network as my windows pc
    Ip address 192.1.2.123
    Subnet 192.1.2.
    Default gateway 192.1.2.1

    Eth0 connected to a cellular modem which has a public address of 184.1.2.234
    Default gateway 184.1.2.1

    I do have to remove one of the default gateways, otherwise the linux box acts erratically (does not connect to the internet), thus the line 'up route del -net default' in my interfaces file.

  9. #8
    Linux Engineer Kloschüssel's Avatar
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    773
    First, your private subnet is not valid - even though that shouldn't cause problems you should change it to one of the subnets mentioned before. The easiest thing would be to swap the 192 with 10, so that your subnet is 10.1.2.0/24, which in turn is a subnet of the private subnet 10.0.0.0/8.

    Second: there are network drivers around that do not properly set up routes on ifup and thus there are cases where you need to do it manually. Of course the default route "default 192.1.2.1 0.0.0.0 UG 0 0 0 ath0" is wrong and should read as "default 184.1.2.1 0.0.0.0 UG 0 0 0 eth0" since that is the "way to the rest of the world". I've seen similar things on a openwrt/kamikaze with pppoe connections and it turned out that it was caused by the drivers shipped with an old 2.4 kernel (please beat me if I'm wrong here - it happened a few years ago).

    What distribution are you using on the linux box? Have you searched the web for bug reports regarding your distribution and the kernel you're using? Would be a kernel upgrade an option for you?

    How do you ssh into your linux box from your windows host? It shouldn't be "ssh 184.1.2.1" but "ssh 192.168.1.2.123".

    Cheers
    Last edited by Kloschüssel; 03-30-2012 at 07:24 AM. Reason: fix typos

  10. #9
    Just Joined!
    Join Date
    May 2009
    Posts
    72
    I'm not actually showing the real ip addresses because it's irrelevant. My network is fine.
    I haven't looked up bugs about this. I'm using a light debian based linux called voyage-linux; kernel 2.6.26-486.
    I do have to ssh into 184.1.2.234. This linux box will 'travel' and the only way to support it then will be through the modem.
    And it does work if I make 184.1.2.1 my default gateway, but in order for other things to work on my box I wanted to leave my private gateway as my default gateway. I'm just trying to understand why it doesn't work when I do that.

    Thanks for the help.

  11. #10
    Just Joined!
    Join Date
    May 2009
    Posts
    72
    I ended up making the modem my default gateway and creating a specific route for my other needs.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •