Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Switch between WLAN and LAN

  1. #1
    Junior Member
    Join Date
    Jan 2010
    Posts
    34

    Question Switch between WLAN and LAN

    Hello all,
    i boot up, surf the internet using my eth0 cable modem, all is good.
    Then i connect to a wireless network with my wireless card ath0, all is good.

    When i disconnect from the wireless network, i can no longer surf the net with my cable modem

    I must be missing something, i have googled this but my search phrase is a bit to exact or somethin. Can someone plz tell me what i am not doing and why my firefox cant connect after using wireless. How do i switch back to my eth0?

  2. #2
    Junior Member Relentless's Avatar
    Join Date
    Jan 2010
    Posts
    59

    Default

    Try this in the shell console:

    >su
    bt~# cd /etc/dhcpc
    bt dhcpc # ls
    dhcpcd-ath0.cache dhcpcd-ath0.info dhcpcd-ath0.info.old
    bt dhcpc # rm *

    the rm * (removes all your old configs), then try to connect wirlessly again.

    Xploitz has also posted this

    forums.remote-exploit.org/showthread.php?t=7117&highlight=wpa_supplicant

    just put the hxxp:// before forums, I still can't post links.

  3. #3
    Member
    Join Date
    Nov 2007
    Posts
    220

    Default

    I have heard of situations where removing a wireless connection didnt revert the routing table (though may have just been 3G sticks, cant remember)

    #ip route show

    do this inbetween every connect/disconnect and look for the default gateway change etc ?
    wtf?

  4. #4
    Very good friend of the forum Virchanza's Avatar
    Join Date
    Jan 2010
    Posts
    863

    Default

    Quote Originally Posted by Andy90 View Post
    I have heard of situations where removing a wireless connection didnt revert the routing table
    Nice catch. To show the routing table I use the following:

    route -n

    It gives you the entire routing table. For a very simple internet connection, you'd probably get:

    Code:
    Kernel IP routing table
    Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
    192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 wlan0
    0.0.0.0         192.168.1.254   0.0.0.0         UG    0      0        0 wlan0
    However, if you had two simultaneous internet connections, one via wired and one via wireless, it might look like this:

    Code:
    Kernel IP routing table
    Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
    192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 wlan0
    192.168.1.0     0.0.0.0         255.255.255.0   U     1      0        0 eth0
    0.0.0.0         192.168.1.254   0.0.0.0         UG    0      0        0 wlan0
    0.0.0.0         192.168.1.254   0.0.0.0         UG    1      0        0 eth0
    If there are two identical routes for two different network interfaces, then the one with the lower metric is chosen. (If the metrics are the same, I think it uses the routing entry that comes first, I'm not sure).

    If you're having trouble still, then just show us what you get when you type "route -n".
    Ask questions on the open forums, that way everybody benefits from the solution, and everybody can be corrected when they make mistakes. Don't send me private messages asking questions that should be asked on the open forums, I won't respond. I decline all "Friend Requests".

  5. #5
    Junior Member
    Join Date
    Jan 2010
    Posts
    34

    Default

    @Oktet
    I read the post from Xploitz but that is not my problem. thanx anyway though!

    Here are my routing tables before i use wireless

    Code:
    Kernel IP routing table
    Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
    74.196.188.0    *               255.255.255.0   U     0      0        0 eth0
    loopback        *               255.0.0.0       U     0      0        0 lo
    default         74.196.188.1    0.0.0.0         UG    0      0        0 eth0
    and after i use wireless

    Code:
    Kernel IP routing table
    Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
    192.168.2.0     *               255.255.255.0   U     0      0        0 ath0
    74.196.188.0    *               255.255.255.0   U     0      0        0 eth0
    loopback        *               255.0.0.0       U     0      0        0 lo
    default         192.168.2.1     0.0.0.0         UG    0      0        0 ath0
    default         c74-196-188-1.d 0.0.0.0         UG    0      0        0 eth0
    im a bit noobish but i don't want 2 simaltaneous connections, or to mac spoof, i just want my default gateway to go back to eth0 after im done on ath0.
    dhcp seems to be running on eth0 cuz when i type dhcpcd it says it already running. yeah i know im really confused here. how does firefox know which interface to use? been lookin everywhere for days before i just gave in and asked, but my head is starting to hurt! lol

    thanx to all the replies guys

  6. #6

    Default

    i just want my default gateway to go back to eth0 after im done on ath0.
    When you are done with your wireless interface:

    Code:
    ifconfig ath0 down
    This should clean "ath0" out from your route table. If not:

    Code:
    route del default gw 192.168.2.1 ath0
    how does firefox know which interface to use?
    Firefox doesn't, your TCP/IP stack does. If there is a metric, then the lowest number wins. If not, I believe that each interface is tried in succession and the first one to respond wins (though I am not positive about this).

    sorry Virchanza; didn't see that you posted much of the same thing earlier. My apologies.

  7. #7
    Junior Member
    Join Date
    Jan 2010
    Posts
    34

    Default

    Kinda fixed maybe a better way though-

    cybrsnpr... i tried "ifconfig ath0 down" which did bring down ath0 from routing table and ifconfig, but i still got "this page cannot be displayed" or whatever.

    I then deleted the default gw on eth0 from the routing table (which was the only one left after i brouught down ath0) and added it back which didn't help either.

    what did seem to work was delete /etc/dhcpc/dhcpcd-eth0.pid
    then restart dhcpcd eth0

    So now my question is,
    Why do i have to restart my dhcpcd and delete the file for eth0 after i use my ath0? is this just my case or what? just curious. BTW-im running BT3 from a usb stick and all is good with persistent changes. this is my only issue
    thanx!

  8. #8
    Junior Member
    Join Date
    Jan 2010
    Posts
    34

    Default

    @Oktet
    Sorry, this must have been what you were talking about thanks man. that was really getting to me; all good now

  9. #9

    Default

    I think your /etc/resolv.conf was being overwritten by the DNS server assigned by ath0.
    When you took down that interface, the resolv.conf file would not get updated.
    Removing the eth0.pid file and then requesting a new DHCP lease via eth0 would then write a good DNS server into the resolv.conf file.

  10. #10
    Junior Member
    Join Date
    Jan 2010
    Posts
    34

    Default

    Yes cybrsnpr, i tested and you are exactly right.
    when i connect to my wireless, it changes my resolv.conf and didn't change it back until i did that.

    what is wierd is i have two different resolv.conf files:
    1resolv.conf
    2resolv.conf-ath0.sv

    Normal right?
    The wierd part is right now while im on my wireless ath0, my correct eth0 dns addy is in the ath0.sv file and the correct ath0 dns addy is in the regular resolv.conf this seems backwards but i'm not necessarily questioning it. This is probably routine to most of you but interesting to my noobular logic

Page 1 of 2 12 LastLast

Posting Permissions

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