Tiny Core Linux

Tiny Core Base => TCB Q&A Forum => Topic started by: wolf_core on August 11, 2012, 10:18:21 AM

Title: WiFi problem
Post by: wolf_core on August 11, 2012, 10:18:21 AM
Hi, i have installed an USB WiFi key on my microserver tuning TC 4.5.6 and the kay established a wifi connection to the router but if i disconnect the ethernet cable the wifi connection is lost. The problem is that the link will not work if i didn't ping the router to start the connection.

Code: [Select]
tc@box:~$ dmesg
............
rtl8192cu: MAC address: 00:0b:81:84:37:18
rtl8192cu: Board Type 0
rtl8192cu: rx_max_size 15360, rx_urb_num 8, in_ep 1
ieee80211 phy0: Selected rate control algorithm 'rtl_rc'
usbcore: registered new interface driver rtl8192cu
8139too 0000:00:0d.0: eth0: link down
rtl8192cu: MAC auto ON okay!
rtl8192cu: Tx queue select: 0x05
rtl8192c: Loading firmware file rtlwifi/rtl8192cufw.bin
wlan0: authenticate with 00:18:3f:78:c4:29 (try 1)
wlan0: authenticated
wlan0: associate with 00:18:3f:78:c4:29 (try 1)
wlan0: RX AssocResp from 00:18:3f:78:c4:29 (capab=0x431 status=0 aid=1)
wlan0: associated



Code: [Select]
tc@box:~$ ifconfig
eth0      Link encap:Ethernet  HWaddr 00:50:f6:26:1b:da
          inet addr:192.168.1.100  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:4442 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3312 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:275085 (268.6 KiB)  TX bytes:944443 (922.3 KiB)
          Interrupt:11 Base address:0xa000

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:105 errors:0 dropped:0 overruns:0 frame:0
          TX packets:105 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:9532 (9.3 KiB)  TX bytes:9532 (9.3 KiB)

wlan0     Link encap:Ethernet  HWaddr 00:0b:81:84:37:18
          inet addr:192.168.1.101  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:7473 errors:0 dropped:1486 overruns:0 frame:0
          TX packets:120 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:775184 (757.0 KiB)  TX bytes:7200 (7.0 KiB)

tc@box:~$

Code: [Select]
tc@box:/opt$ cat eth0.sh
#!/bin/sh
#pkill udhcpc
ifconfig eth0 192.168.1.100 netmask 255.255.255.0 broadcast 192.168.1.255 up
route add default gw 192.168.1.254
echo nameserver 192.168.1.254 > /etc/resolv.conf
echo nameserver 8.8.8.8 >> /etc/resolv.conf
tc@box:/opt$
tc@box:/opt$
tc@box:/opt$ cat wlan0.sh
#!/bin/sh
#pkill udhcpc
wpa_supplicant -Dwext -iwlan0 -c/etc/wpa_gui.conf -B
sleep=15
ifconfig wlan0 192.168.1.101 netmask 255.255.255.0 broadcast 192.168.1.255 up
route add default gw 192.168.1.254
echo nameserver 192.168.1.254 > /etc/resolv.conf
echo nameserver 8.8.8.8 >> /etc/resolv.conf
tc@box:/opt$


Code: [Select]
tc@box:/opt$ cat bootlocal.sh
#!/bin/sh
# put other system startup commands here
/opt/eth0.sh &
/opt/wlan0.sh &
/etc/init.d/dropbear start
tc@box:/opt$


Code: [Select]
tc@box:/etc$ cat wpa_gui.conf
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=staff
update_config=1

network={
        ssid="2WIRE589"
        key_mgmt=NONE
        auth_alg=OPEN
        wep_key0=xxxxxxxxxxxxxxxxxxxxx
        wep_tx_keyidx=0
        priority=5
}
tc@box:/etc$

Thanks in advance Luca
Title: Re: WiFi problem
Post by: tinypoodle on August 11, 2012, 11:02:46 AM
I'd suspect that adding 2 concurrent default gateway routes might lead to unpredictable results.
Title: Re: WiFi problem
Post by: tinypoodle on August 11, 2012, 11:58:33 AM
After a bit of googling found this:

http://www.ni.com/white-paper/12558/en

HTH
Title: Re: WiFi problem
Post by: wolf_core on August 11, 2012, 12:08:08 PM
Hi tinypoodle, i have modified eth0.sh and now it  seems working.

Code: [Select]
tc@box:/opt$ cat eth0.sh
#!/bin/sh
#pkill udhcpc
ifconfig eth0 192.168.1.100 netmask 255.255.255.0 broadcast 192.168.1.255 up
#route add default gw 192.168.1.254
#echo nameserver 192.168.1.254 > /etc/resolv.conf
#echo nameserver 8.8.8.8 >> /etc/resolv.conf
ifconfig eth0 down
tc@box:/opt$

Thanks again Luca
Title: Re: WiFi problem
Post by: wolf_core on August 16, 2012, 11:08:14 AM
Hi, the strange thing is that i can connect to the ip 192.168.1.100 and 192.168.1.101 though i have deactivated eth0 (192.168.1.100)

Code: [Select]
tc@box:~$ ifconfig
lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:24 errors:0 dropped:0 overruns:0 frame:0
          TX packets:24 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:1200 (1.1 KiB)  TX bytes:1200 (1.1 KiB)

wlan0     Link encap:Ethernet  HWaddr 00:0b:81:84:37:18
          inet addr:192.168.1.101  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:30867 errors:0 dropped:6816 overruns:0 frame:0
          TX packets:3741 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:3528319 (3.3 MiB)  TX bytes:682099 (666.1 KiB)

tc@box:~$

Code: [Select]
tc@box:/opt$ cat eth0.sh
#!/bin/sh
#pkill udhcpc
ifconfig eth0 192.168.1.100 netmask 255.255.255.0 broadcast 192.168.1.255 up
#route add default gw 192.168.1.254
#echo nameserver 192.168.1.254 > /etc/resolv.conf
#echo nameserver 8.8.8.8 >> /etc/resolv.conf
ifconfig eth0 down
tc@box:/opt$

Code: [Select]
tc@box:~$ ping 192.168.1.101
PING 192.168.1.101 (192.168.1.101): 56 data bytes
64 bytes from 192.168.1.101: seq=0 ttl=64 time=2.266 ms
64 bytes from 192.168.1.101: seq=1 ttl=64 time=0.351 ms
64 bytes from 192.168.1.101: seq=2 ttl=64 time=0.473 ms
^C
--- 192.168.1.101 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 0.351/1.030/2.266 ms

Code: [Select]
tc@box:~$ ping 192.168.1.100
PING 192.168.1.100 (192.168.1.100): 56 data bytes
64 bytes from 192.168.1.100: seq=0 ttl=64 time=0.582 ms
64 bytes from 192.168.1.100: seq=1 ttl=64 time=0.352 ms
64 bytes from 192.168.1.100: seq=2 ttl=64 time=0.351 ms
64 bytes from 192.168.1.100: seq=3 ttl=64 time=0.350 ms
^C
--- 192.168.1.100 ping statistics ---
4 packets transmitted, 4 packets received, 0% packet loss
round-trip min/avg/max = 0.350/0.408/0.582 ms

Thanks Luca
Title: Re: WiFi problem
Post by: Rich on August 16, 2012, 08:12:00 PM
Hi wolf_core
That does sound strange. I executed an  ifconfig down  command on one of my machines, and it too responded
to a local ping command. It could not, however, ping a second machine, nor did it respond to a ping from a
second machine.
Title: Re: WiFi problem
Post by: tinypoodle on August 17, 2012, 12:26:11 AM
1. What is strange is your configuration, so you shouldn't be too surprised about any results.
From the paper I linked to in an earlier post:

Quote
Rule 2: Avoid Assigning Multiple NICs in the Same Computer to the Same Subnet

Using multiple NICs on the same subnet is the #1 cause of connectivity issues on multi-NIC systems.

2. You are not pinging an interface, but an IP - and when sending packets to one of your hosts own IP addresses, they may be routed to the loopback interface in either case (which may explain Rich's observation).
Title: Re: WiFi problem
Post by: tinypoodle on August 17, 2012, 12:51:40 AM
Hi wolf_core
That does sound strange. I executed an  ifconfig down  command on one of my machines, and it too responded
to a local ping command. It could not, however, ping a second machine, nor did it respond to a ping from a
second machine.

I think for ping responses of local host it is only of relevance if the loopback interface is up or down, the up/down status of the NIC interface is irrelevant. ;)
Title: Re: WiFi problem
Post by: Rich on August 17, 2012, 05:44:19 AM
I don't have any wireless equipment so I don't know if this is normal, but reply #4 shows over 20% of the RX
packets as being dropped.
Title: Re: WiFi problem
Post by: wolf_core on August 17, 2012, 03:36:59 PM
Thanks Rich and tinypoodle, i will try to change the ip address of eth0 interface  from 192.168.1.100 to 10.10.10.100 before changing it's state to down and than i try to ping the interface and looking if the interface will answer.
Title: Re: WiFi problem
Post by: tinypoodle on August 18, 2012, 03:20:16 AM
That should exclude conflicts, but what I still cannot understand is why you would even configure and bring up eth0 in the first place.

Please read Reply #6 again - as you still talk about pinging an interface...