WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Wifi to cross over cable setup  (Read 3375 times)

Offline TroyB

  • Newbie
  • *
  • Posts: 37
Wifi to cross over cable setup
« on: June 07, 2011, 02:45:56 AM »
Hi all,

I was wondering if someone can shed some light to the following issue I'm having.

I have two PCs, PC1 is connect to the internet via wifi, this is also connect to PC2 with a cross over cable.

PC1 wifi is working fine with the following entries in bootlocal.sh, but when I add the entry for eth0 in bootlocal.sh, I lose internet connectivity, but I can ping PC2 from PC1 and vice vesa.

It seem that entries in bootlocal.sh for wlan0 is taken over by eth0 and internet connectivity is lost.

My question is, how can I have wifi on PC1 while still be able to ping PC2 with a cross over cable?


Thanks for your time.
Troy

Offline maro

  • Hero Member
  • *****
  • Posts: 1228
Re: Wifi to cross over cable setup
« Reply #1 on: June 07, 2011, 05:17:26 PM »
Sounds like an issue with the routing to me. For us to get a better idea of your setup would you please share here the output from PC1 of:
    ifconfig -a ; route ; cat /proc/cmdline ; cat /opt/bootlocal.sh

Offline TroyB

  • Newbie
  • *
  • Posts: 37
Re: Wifi to cross over cable setup
« Reply #2 on: June 08, 2011, 02:45:36 AM »
Sounds like an issue with the routing to me. For us to get a better idea of your setup would you please share here the output from PC1 of:
    ifconfig -a ; route ; cat /proc/cmdline ; cat /opt/bootlocal.sh


Hi Maro,

Thank you for your reply.

I have the following output following your instructions before and after I enter in the details in the network interface of control panel.

root@box:~# ifconfig -a
dummy0    Link encap:Ethernet  HWaddr 2E:32:B4:8A:8A:05 
          BROADCAST NOARP  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

eth0      Link encap:Ethernet  HWaddr 00:25:11:44:06:2E 
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:327 (327.0 B)
          Interrupt:26 Base address:0xe000

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:12 errors:0 dropped:0 overruns:0 frame:0
          TX packets:12 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:600 (600.0 B)  TX bytes:600 (600.0 B)

wlan0     Link encap:Ethernet  HWaddr 00:25:86:B0:BC:EB 
          inet addr:192.168.0.2  Bcast:192.168.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:394 errors:0 dropped:0 overruns:0 frame:0
          TX packets:419 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:328056 (320.3 KiB)  TX bytes:91141 (89.0 KiB)

root@box:~# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
127.0.0.1       *               255.255.255.255 UH    0      0        0 lo
192.168.0.0     *               255.255.255.0   U     0      0        0 wlan0
default         192.168.0.1     0.0.0.0         UG    0      0        0 wlan0

root@box:~# cat /proc/cmdline
BOOT_IMAGE=/boot/bzImage quiet swapon=sda1 tce=sda2 opt=sda2 home=sda3 xvesa=1400x1050x24

root@box:~# cat /opt/bootlocal.sh
#!/bin/sh
# put other system startup commands here
/opt/wlan0.sh &

I have entered in the following for the Network Interface in control panel.

eth0
IP 192.168.0.3
Network mask 255.255.255.0
Boardcast 192.168.0.255
Gateway 192.168.0.1
Nameserver 192.168.0.1

root@box:~# ifconfig -a
dummy0    Link encap:Ethernet  HWaddr F6:AC:4C:D6:2A:09 
          BROADCAST NOARP  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

eth0      Link encap:Ethernet  HWaddr 00:25:11:44:06:2E 
          inet addr:192.168.0.3  Bcast:192.168.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:327 (327.0 B)
          Interrupt:26 Base address:0xe000

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:14 errors:0 dropped:0 overruns:0 frame:0
          TX packets:14 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:700 (700.0 B)  TX bytes:700 (700.0 B)

wlan0     Link encap:Ethernet  HWaddr 00:25:86:B0:BC:EB 
          inet addr:192.168.0.2  Bcast:192.168.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:875 (875.0 B)  TX bytes:702 (702.0 B)

root@box:~# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
127.0.0.1       *               255.255.255.255 UH    0      0        0 lo
192.168.0.0     *               255.255.255.0   U     0      0        0 eth0
192.168.0.0     *               255.255.255.0   U     0      0        0 wlan0

root@box:~# cat /opt/bootlocal.sh
#!/bin/sh
# put other system startup commands here
/opt/wlan0.sh &
/opt/eth0.sh &

root@box:~# /opt/wlan0.sh
udhcpc (v1.18.3) started
Sending discover...
Sending select for 192.168.0.2...
Lease of 192.168.0.2 obtained, lease time 259200
deleting routers
route: SIOCDELRT: No such process
adding dns 192.168.0.1

Running chrome, but default page of google is not found. Only when the entry /opt/eth0.sh & of bootlocal.sh is removed. I have the wireless connection again.

But comparing the two routes above the before route and the after route, I have notice the missing entry;

default         192.168.0.1     0.0.0.0         UG    0      0        0 wlan0

Thanks again.
Troy

Offline maro

  • Hero Member
  • *****
  • Posts: 1228
Re: Wifi to cross over cable setup
« Reply #3 on: June 08, 2011, 03:46:50 AM »
Looks to me somewhat similar to this earlier thread: You have two interfaces pointing to the same gateway and two routes to it but in your case no default route (after you've configured 'eth0').

I'd suggest to add a default route (e.g. via sudo route add default gw 192.168.0.1 wlan0) after you've enabled 'eth0'. This might bring back connectivity to the outside world (e.g. google) from PC1. But I'm not sure what it will do to connection between PC1 and PC2. My hunch is that you'll require another another specific route for this.

Clearly the 'network' GUI (that you might have used to create '/opt/eth0.sh') is not really a tool for setting up a router configuration. So for starters we would need to know the content of '/opt/wlan0.sh' and '/opt/eth0.sh' from PC1. And we also need some information how PC2 is configured to work out any missing pieces.

Note: I'm not really a networking (or routing) expert. My knowledge is more based on broader principles, but giving enough time I'm usually able to make up any kind of story. But that should not stop anyone who knows this stuff to step in here. In particular as I won't be able at least in the next 36-48h to help any further.

Offline TroyB

  • Newbie
  • *
  • Posts: 37
Re: Wifi to cross over cable setup
« Reply #4 on: June 08, 2011, 09:37:58 AM »
Hi Maro,

Thanks for your reply.

I was a bit too early in reading the output of route after adding in eth0, here is the new output.

root@box:~# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
127.0.0.1       *               255.255.255.255 UH    0      0        0 lo
192.168.0.0     *               255.255.255.0   U     0      0        0 eth0
192.168.0.0     *               255.255.255.0   U     0      0        0 wlan0
default         192.168.0.1     0.0.0.0         UG    0      0        0 eth0
default         192.168.0.1     0.0.0.0         UG    0      0        0 wlan0


root@box:~# cat /opt/wlan0.sh
#!/bin/sh
pkill udhcpc
iwconfig wlan0 essid "XX" key XXXXXXXXXXXXXX
udhcpc -H box -b -i wlan0


root@box:~# cat /opt/eth0.sh
#!/bin/sh
pkill udhcpc
ifconfig eth0 192.168.0.3 netmask 255.255.255.0 broadcast 192.168.0.255 up
route add default gw 192.168.0.1
echo nameserver 192.168.0.1 > /etc/resolv.conf


PC1 is TCL wifi (192.168.0.2) connected to the web, while eth0 (192.168.0.3) on PC1 is using a cross over cable connect to PC2 which is OpenBSD NIC card de0 (192.168.0.254).


Hope this is the information your after?

Thanks again for your time.


« Last Edit: June 08, 2011, 09:50:40 AM by TroyB »

Offline maro

  • Hero Member
  • *****
  • Posts: 1228
Re: Wifi to cross over cable setup
« Reply #5 on: June 08, 2011, 06:23:40 PM »
OK, that looks more like the other issue now: So (again) carefully read the other thread and try to apply something similar for your situation (by removing the surplus default route for 'eth0').

On second thoughts: Removing the indicated lines from '/opt/eth0.sh' might also get you there:
    #!/bin/sh
    pkill udhcpc
    ifconfig eth0 192.168.0.3 netmask 255.255.255.0 broadcast 192.168.0.255 up
    route add default gw 192.168.0.1
    echo nameserver 192.168.0.1 > /etc/resolv.conf


This way it would not kill the DHCP client for 'wlan0', add the troublesome default route for 'eth0' and the overwriting of the DNS server config (with the same value obtained via DHCP for by '/opt/wlan0.sh').

BTW, I'm not certain that the netmask and broadcast values for 'eth0' are appropriate as 'eth0' should only connect to a single host (i.e. '192.168.0.254'). Can't test this out now, but should be able to reproduce your setup here in the next few days.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11634
Re: Wifi to cross over cable setup
« Reply #6 on: June 08, 2011, 07:23:37 PM »
Quote
BTW, I'm not certain that the netmask and broadcast values for 'eth0' are appropriate as 'eth0' should only connect to a single host (i.e. '192.168.0.254'). Can't test this out now, but should be able to reproduce your setup here in the next few days.

If the address of the link between the PCs was changed to 192.168.1 would that make it a non issue?
Or is there a reason all three interfaces need to be on 192.168.0?