Find the answer to your Linux question:
Results 1 to 7 of 7
Hello, I have a weird problem. My system has two network adapters, one with a 192.x address and one with a 10.x address. I connect to the Internet over a ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined! SheriffHobbes's Avatar
    Join Date
    Nov 2010
    Location
    Germany (GDR 2.0)
    Posts
    8

    Applications use the "wrong" IP address


    Hello,

    I have a weird problem. My system has two network adapters, one with a 192.x address and one with a 10.x address. I connect to the Internet over a proxy that also has one 192.x address and one 10.x address. The name of this proxy is added to /etc/hosts with the 10.x address. Additionally, the network settings for the 10.x adapter include the proxy as gateway. The 192.x adapter has no gateway. If I ping the proxy, it is correctly resolved over the 10.x address.

    All my applications are set to "directly connect to the Internet".
    Some apps (the "good" ones) use the 10.x address to connect to the proxy, while some others (e.g. Firefox, the "bad" ones) use the 192.x address. The latter fail to connect to the Internet because the proxy is configured to let traffic through the 10.x adapter only.

    Any ideas why some apps try the 192.x-way? I don't see any reason they should do this, see network config above.

    Thanks,
    Hobbes

    P.S.: system is RHEL 5.5

  2. #2
    Linux Newbie nplusplus's Avatar
    Join Date
    Apr 2010
    Location
    Charlotte, NC, USA
    Posts
    106
    What is the output of the "route" command from the cli?

  3. #3
    Just Joined!
    Join Date
    Mar 2011
    Location
    NH
    Posts
    14
    When an application makes a network connection, it usually binds to a socket with the INADDR_ANY constant (usually resolves to 0.0.0.0). The system then decides which interface to send traffic on.

    A lot of things determine which interface the system will choose. When you use ping, the system knows which address you are trying reach and chooses the one with the shortest route. Another way the system can select an interface is by using the interface "metric", which you can thing of as a rating system.

    I'm going to guess that the 192.168.x subnet exists for some internal usage that you don't want to have access outside of the devices directly on the subnet. However, you can play around with some settings and see what works.

    To start with, try this link /0pointer.de/lennart/projects/ifmetric/ which gives you a way to assign different metrics to the interfaces. If Firefox is attempting to connect to 111.111.111.111, it has no way of knowing which interface would give the shortest route. By setting the metric on the 10.x interface to be preferred, it should pick that one. Any traffic going to the 192.168.x subnet would still use the other interface because interfaces in the same subnet should get preference.

    DISCLAIMOR: With all the different distros and versions, you may have to play around a bit to see what works for you.

  4. $spacer_open
    $spacer_close
  5. #4
    Linux Newbie
    Join Date
    Jun 2004
    Location
    Halesowen, West Midlands, UK
    Posts
    107
    I have an ethernet connection which is the 192.168.10 subnet and a WiFi connection which is on the 192.168.1 subnet.
    The 192.168.10 addresses get routed to thegateway 192.168.10.103 (router) and the 192.168.1 addresses get routed to 192.168.1.1 which is the wlan (WiFi).
    # route -n
    Kernel IP routing table
    Destination Gateway Genmask Flags Metric Ref Use Iface
    0.0.0.0 192.168.10.103 0.0.0.0 UG 0 0 0 br0
    127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
    169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 wlan0
    192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 wlan0
    192.168.10.0 0.0.0.0 255.255.255.0 U 0 0 0 br0
    br0 is my ethernet bridge.I just noticed I haven't set the default Gateway for the wlan.sepulot:~ # route add -net 92.168.1.0/24 gw 192.168.1.1
    sepulot:~ # route -n
    Kernel IP routing table
    Destination Gateway Genmask Flags Metric Ref Use Iface
    0.0.0.0 192.168.10.103 0.0.0.0 UG 0 0 0 br0
    92.168.1.0 192.168.1.1 255.255.255.0 UG 0 0 0 wlan0
    127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
    169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 wlan0
    192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 wlan0
    192.168.10.0 0.0.0.0 255.255.255.0 U 0 0 0 br0
    Last edited by Siddly; 05-04-2011 at 01:08 AM.

  6. #5
    Just Joined! SheriffHobbes's Avatar
    Join Date
    Nov 2010
    Location
    Germany (GDR 2.0)
    Posts
    8
    Thanks for the responses.

    @nplusplus: this is my routing table:

    Destination Gateway Genmask Flags Metric Ref Use Iface
    192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 seth1
    169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 seth1
    10.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 seth0
    0.0.0.0 10.0.0.100 0.0.0.0 UG 0 0 0 seth0

    @rabinnh: ifmetric looks interesting. I will try that out. The 192.x is for connecting to the client from other clients via VNC. The 10.x is an internal virtual network.

    @Siddly: 10.0.0.100 is the proxy. Since this is the gateway of the 10.x adapter, I don't understand how an application might choose 192.168.0.100 instead. If I don't set this gateway, I wouldn't have any internet access. I've also set the 10.0.0.100 in Firefox as proxy, but even then there came a pop-up window from the proxy asking for credentials and the pop-up shows the address 192.168.0.100!! This is very strange. Maybe the initial connection to proxy is correctly done with 10.x, but the proxy itself answers with 192.x?? That would also be strange because the client is added to the proxy's hosts file with the 10.x address.

  7. #6
    Just Joined! SheriffHobbes's Avatar
    Join Date
    Nov 2010
    Location
    Germany (GDR 2.0)
    Posts
    8
    ifmetric didn't help.

    I found out another weird thing: When I use Firefox as root with the same settings - it works!

  8. #7
    Linux Newbie
    Join Date
    Jun 2004
    Location
    Halesowen, West Midlands, UK
    Posts
    107
    Possibly /etc/resolv.conf, here's mine for my 2 segments
    nameserver 192.168.10.103
    nameserver 192.168.1.1

Posting Permissions

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