LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 02-14-2010, 11:21 AM   #1
gregorian
Member
 
Registered: Apr 2006
Posts: 509

Rep: Reputation: 34
Dynamic routing isn't done; static routing works for about 2 seconds for wireless


I'm using Gentoo. When I try to run net.wlan0 I get to the point where I receive an IP address, followed by this message:

wlan0: add_route: Network is unreachable

Alternatively, when I run wicd, I get the IP address but the routing table is empty. The internet works in Windows and systems running Fedora and Ubuntu so I know it's not a network problem.

I tried to setup static routing by observing this routing table on an Ubuntu system:

Code:
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
<gateway>     *               255.255.255.255 UH    0      0        0 wlan0
link-local      *               255.255.0.0     U     1000   0        0 wlan0
default         <gateway>     0.0.0.0         UG    0      0        0 wlan0
This is the script I wrote.

Code:
#!/bin/bash
route add -host <gateway> wlan0
route add default gw <gateway>
route add -host link-local wlan0
I need to execute this immediately after I get the IP address. If I do so, I'm able to connect to the internet for about 2 seconds. After that everything just times out.

Any help would be appreciated.

Last edited by gregorian; 02-14-2010 at 11:25 AM.
 
Old 02-15-2010, 08:14 PM   #2
allanf
Member
 
Registered: Sep 2008
Location: MN
Distribution: Gentoo, Fedora, Suse, Slackware, Debian, CentOS
Posts: 100
Blog Entries: 1

Rep: Reputation: 20
Code:
route add -net link-local/16 wlan0
route add default gw <gateway> wlan0
The "/16" says that you have 16 bits of netmask (255.255.0.0) and "link-local"
is the net address assigned to your computer. Your IP Address is not in the route table (not needed and should not be there!).

Are you getting "link-local" from the access point or did you define it in your "/etc" diretory? As this needs to be the net address. For example if the "IP Address" is 172.16.0.10 and the netmask is 255.255.0.0 then the netmask is 172.16.0.0 while an IP address of 192.168.100.10 with a netmask of 255.255.255.0, the net address is 192.168.100.0
 
Old 02-15-2010, 08:32 PM   #3
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
Why are you using host routes?

Is the wireless a pppoe connection or is it a router?

For a wireless router I would expect this:
Code:
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.1.0     *               255.255.255.0   U     1      0        0 wlan0
loopback        *               255.0.0.0       U     0      0        0 lo
default         router          0.0.0.0         UG    0      0        0 wlan0
 
Old 02-17-2010, 05:59 AM   #4
gregorian
Member
 
Registered: Apr 2006
Posts: 509

Original Poster
Rep: Reputation: 34
Quote:
Originally Posted by allanf
The "/16" says that you have 16 bits of netmask (255.255.0.0) and "link-local"
is the net address assigned to your computer. Your IP Address is not in the route table (not needed and should not be there!).
Are you asking me to add the "/16"? Regarding the link-local I haven't done anything. It was just there in the routing table of an Ubuntu computer that successfully connected to the AP. I just tried to replicate the routing table in my system but that works successfully very rarely.

I did not add anything in my /etc directory but it's possible that it might be present on an Ubuntu install. I'm using Gentoo and I never did anything of the sort.

Quote:
Originally Posted by jschiwal
Why are you using host routes?

Is the wireless a pppoe connection or is it a router?
My routing table is empty except for the loopback interface. The wireless connection is to an access point I connect to. I expect a router, but I'm not sure.

These are the outputs of Windows commands:

ipconfig
Code:
  Connection-specific DNS Suffix  . :
  Description . . . . . . . . . . . : Broadcom 802.11g Network Adapter
  Physical Address. . . . . . . . . : <I removed this>
  DHCP Enabled. . . . . . . . . . . : Yes
  Autoconfiguration Enabled . . . . : Yes
  Link-local IPv6 Address . . . . . : fe80::7014:319d:f5fa:914c%12(Preferred)
  IPv4 Address. . . . . . . . . . . : 172.16.70.189(Preferred)
  Subnet Mask . . . . . . . . . . . : 255.255.255.255
  Lease Obtained. . . . . . . . . . : Wednesday, February 17, 2010 4:58:40 PM
  Lease Expires . . . . . . . . . . : Thursday, February 18, 2010 4:58:41 PM
  Default Gateway . . . . . . . . . : fe80::14a4:555c:6e07:d708%12
                                      172.16.70.1
  DHCP Server . . . . . . . . . . . : 172.16.70.1
  DHCPv6 IAID . . . . . . . . . . . : 218109093
  DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-12-7D-A5-4F-00-C0-9F-D9-A4-00

  DNS Servers . . . . . . . . . . . : 172.16.70.1
  NetBIOS over Tcpip. . . . . . . . : Enabled
route print
Code:
IPv4 Route Table
===========================================================================
Active Routes:
Network Destination        Netmask          Gateway       Interface  Metric
          0.0.0.0          0.0.0.0      172.16.70.1    172.16.70.189     30
        127.0.0.0        255.0.0.0         On-link         127.0.0.1    306
        127.0.0.1  255.255.255.255         On-link         127.0.0.1    306
  127.255.255.255  255.255.255.255         On-link         127.0.0.1    306
    172.16.70.189  255.255.255.255         On-link     172.16.70.189    286
        224.0.0.0        240.0.0.0         On-link         127.0.0.1    306
        224.0.0.0        240.0.0.0         On-link     172.16.70.189    286
  255.255.255.255  255.255.255.255         On-link         127.0.0.1    306
  255.255.255.255  255.255.255.255         On-link     172.16.70.189    286
===========================================================================
Persistent Routes:
  Network Address          Netmask  Gateway Address  Metric
          0.0.0.0          0.0.0.0          5.0.0.1  Default
===========================================================================
Thank you for responding!

Last edited by gregorian; 02-17-2010 at 06:01 AM.
 
Old 02-18-2010, 09:49 AM   #5
allanf
Member
 
Registered: Sep 2008
Location: MN
Distribution: Gentoo, Fedora, Suse, Slackware, Debian, CentOS
Posts: 100
Blog Entries: 1

Rep: Reputation: 20
The net mask should not be "255.255.255.255" but should be 255.255.0.0

In linux enter these commands and return the output. okay to change the "essid" and "MAC" addresses (and any password info if any)

Code:
iwconfig
ifconfig
netstat -rn
cat /etc/resolv.conf
lspci
lsmod
 
Old 02-18-2010, 07:22 PM   #6
gregorian
Member
 
Registered: Apr 2006
Posts: 509

Original Poster
Rep: Reputation: 34
Are you sure about my subnet mask? Because I get 255.255.255.255 in Windows(see the previous post output) and also in Linux. Here's the output:

Boot messages:

Code:
wlan0: dhcpcd 4.0.15 starting
wlan0: broadcasting for a lease
wlan0: offered 172.16.70.189 from 172.16.70.1
wlan0: acknowledged 172.16.70.189 from 172.16.70.1
wlan0: checking 172.16.70.189 is available on attached networks
wlan0: leased 172.16.70.189 for 86400 seconds
wlan0: add_route: Network is unreachable        
       wlan0 received address 172.16.70.189/32 (It gives /32)
iwconfig
Code:
lo        no wireless extensions.

eth0      no wireless extensions.

wlan0     IEEE 802.11bg  ESSID:"xxxxxx"
          Mode:Managed  Frequency:2.437 GHz  Access Point: xx:15:xx:xx:xx:xx
	  Bit Rate=6 Mb/s   Tx-Power=27 dBm
	  Retry  long limit:7   RTS thr:off   Fragment thr:off
	  Power Management:off
	  Link Quality=47/70  Signal level=-63 dBm
	  Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
	  Tx excessive retries:0  Invalid misc:0   Missed beacon:0
ifconfig
Code:
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:2 errors:0 dropped:0 overruns:0 frame:0
	  TX packets:2 errors:0 dropped:0 overruns:0 carrier:0
	  collisions:0 txqueuelen:0
	  RX bytes:36 (36.0 B)  TX bytes:36 (36.0 B)

wlan0     Link encap:Ethernet  HWaddr xx:xx:xx:xx:xx:xx
          inet addr:172.16.70.189  Bcast:172.16.70.189  Mask:255.255.255.255
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:416 errors:0 dropped:0 overruns:0 frame:0
          TX packets:9 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:59457 (58.0 KiB)  TX bytes:1128 (1.1 KiB)
netstat -nr

Code:
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
127.0.0.0       0.0.0.0         255.0.0.0       U         0 0          0 lo
cat /etc/resolve.conf

Code:
# Generated by dhcpcd from wlan0
# /etc/resolv.conf.head can replace this line
nameserver 172.16.70.1
# /etc/resolv.conf.tail can replace this line
lscpci
Code:
00:00.0 Host bridge: ATI Technologies Inc RS480 Host Bridge (rev 01)
00:01.0 PCI bridge: ATI Technologies Inc RS480 PCI Bridge
00:13.0 USB Controller: ATI Technologies Inc IXP SB400 USB Host Controller
00:13.1 USB Controller: ATI Technologies Inc IXP SB400 USB Host Controller
00:13.2 USB Controller: ATI Technologies Inc IXP SB400 USB2 Host Controller
00:14.0 SMBus: ATI Technologies Inc IXP SB400 SMBus Controller (rev 11)
00:14.1 IDE interface: ATI Technologies Inc IXP SB400 IDE Controller
00:14.3 ISA bridge: ATI Technologies Inc IXP SB400 PCI-ISA Bridge
00:14.4 PCI bridge: ATI Technologies Inc IXP SB400 PCI-PCI Bridge
00:14.5 Multimedia audio controller: ATI Technologies Inc IXP SB400 AC'97 Audio Controller (rev 02)
00:14.6 Modem: ATI Technologies Inc SB400 AC'97 Modem Controller (rev 02)
00:18.0 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] HyperTransport Technology Configuration
00:18.1 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] Address Map
00:18.2 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] DRAM Controller
00:18.3 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] Miscellaneous Control
01:05.0 VGA compatible controller: ATI Technologies Inc Radeon XPRESS 200M 5955 (PCIE)
05:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL-8139/8139C/8139C+ (rev 10)
05:02.0 Network controller: Broadcom Corporation BCM4318 [AirForce One 54g] 802.11g Wireless LAN Controller (rev 02)
05:09.0 CardBus bridge: Texas Instruments PCIxx21/x515 Cardbus Controller
05:09.2 FireWire (IEEE 1394): Texas Instruments OHCI Compliant IEEE 1394 Host Controller
05:09.3 Mass storage controller: Texas Instruments PCIxx21 Integrated FlashMedia Controller
05:09.4 SD Host controller: Texas Instruments PCI6411/6421/6611/6621/7411/7421/7611/7621 Secure Digital Controller
lsmod
Code:
Module                  Size  Used by
snd_pcm_oss            29565  0 
snd_mixer_oss          11990  1 snd_pcm_oss
snd_seq_oss            22149  0 
snd_seq_midi_event      4460  1 snd_seq_oss
snd_seq                40005  4 snd_seq_oss,snd_seq_midi_event
snd_seq_device          4341  2 snd_seq_oss,snd_seq
dm_mod                 50856  0 
arc4                    1186  2 
ecb                     1753  2 
b43                   144506  0 
mac80211              107808  1 b43
cfg80211              104387  2 b43,mac80211
rfkill                  8488  1 cfg80211
usbhid                 21417  0 
led_class               2313  1 b43
snd_atiixp             10941  0 
snd_atiixp_modem        7907  0 
snd_ac97_codec         97808  2 snd_atiixp,snd_atiixp_modem
ssb                    34462  1 b43
ohci1394               24405  0 
pcmcia                 25885  2 b43,ssb
yenta_socket           18899  1 
ac97_bus                 998  1 snd_ac97_codec
ieee1394               59243  1 ohci1394
rtc                     4850  0 
rsrc_nonstatic          6998  1 yenta_socket
ehci_hcd               30310  0 
snd_pcm                53401  4 snd_pcm_oss,snd_atiixp,snd_atiixp_modem,snd_ac97_codec
pcmcia_core            23399  5 b43,ssb,pcmcia,yenta_socket,rsrc_nonstatic
ohci_hcd               18548  0 
ac                      2072  0 
battery                 4862  0 
8139cp                 15553  0 
processor              24123  1 
snd_timer              14774  2 snd_seq,snd_pcm
firmware_class          5586  2 b43,pcmcia
usbcore               112476  4 usbhid,ehci_hcd,ohci_hcd
8139too                17424  0 
video                  17309  0 
snd                    42679  10 snd_pcm_oss,snd_mixer_oss,snd_seq_oss,snd_seq,snd_seq_device,snd_atiixp,snd_atiixp_modem,snd_ac97_codec,snd_pcm,snd_timer
thermal                11522  0 
soundcore               4415  1 snd
thermal_sys            10533  3 processor,video,thermal
output                  1540  1 video
button                  4514  0 
snd_page_alloc          5761  3 snd_atiixp,snd_atiixp_modem,snd_pcm

Last edited by gregorian; 02-18-2010 at 07:24 PM.
 
Old 02-19-2010, 12:53 AM   #7
allanf
Member
 
Registered: Sep 2008
Location: MN
Distribution: Gentoo, Fedora, Suse, Slackware, Debian, CentOS
Posts: 100
Blog Entries: 1

Rep: Reputation: 20
lspci
05:02.0 Network controller: Broadcom Corporation BCM4318 [AirForce One 54g] 802.11g Wireless LAN Controller (rev 02)

This uses the b43 kernel module which the "lsmod" shows was loaded.
b43 144506 0
mac80211 107808 1 b43
cfg80211 104387 2 b43,mac80211
led_class 2313 1 b43
ssb 34462 1 b43
pcmcia 25885 2 b43,ssb
pcmcia_core 23399 5 b43,ssb,pcmcia,yenta_socket,rsrc_nonstatic
firmware_class 5586 2 b43,pcmcia
It also hows that the firmware has been loaded for it as well.

But we already know that the modules were loaded to have the boot-up messages...

wlan0: dhcpcd 4.0.15 starting
wlan0: broadcasting for a lease
wlan0: offered 172.16.70.189 from 172.16.70.1
wlan0: acknowledged 172.16.70.189 from 172.16.70.1
wlan0: checking 172.16.70.189 is available on attached networks
wlan0: leased 172.16.70.189 for 86400 seconds
wlan0: add_route: Network is unreachable
wlan0 received address 172.16.70.189/32 (It gives /32)

When the netmask is "/32" which is the same as "255.255.255.255". This says that
your computer does not have any host bits for an IP address. Are you attempting to use "dhcp" and an "adhoc" connection? It should be "managed".

The standard IP address of "172.16.70.189" would have a netmask of 255.255.0.0 (or /16) unless it it being sub-networked then it
most probably has a netmask of "255.255.255.0" (or "/24").

Can you become root and issue the commands:
Code:
ifconfig wlan0 172.16.70.189 netmask 255.255.255.0
route add default gw 172.16.70.1 wlan0
cat "nameserver 172.16.70.1" >/etc/resolv.conf
netstat -rn
ping -c 5 www.linuxquestions.org
The "netstat" output should look like:
Code:
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
172.16.70.0     0.0.0.0         255.255.255.0   U         0 0          0 wlan0
127.0.0.0       0.0.0.0         255.0.0.0       U         0 0          0 lo
0.0.0.0         172.16.70.1     0.0.0.0         UG        0 0          0 wlan0
or

Code:
ifconfig wlan0 172.16.70.189 netmask 255.255.0.0
route add default gw 172.16.70.1 wlan0
cat "nameserver 172.16.70.1" >/etc/resolv.conf
netstat -rn
ping -c 5 www.linuxquestions.org
The netstat for this would look like:
Code:
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
172.16.70.0     0.0.0.0         255.255.0.0     U         0 0          0 wlan0
127.0.0.0       0.0.0.0         255.0.0.0       U         0 0          0 lo
0.0.0.0         172.16.70.1     0.0.0.0         UG        0 0          0 wlan0

Did this connect? Then the access point (if it is doing the NAT for you) does not have the dhcp configured correctly.
 
Old 02-19-2010, 06:43 AM   #8
gregorian
Member
 
Registered: Apr 2006
Posts: 509

Original Poster
Rep: Reputation: 34
Well it still doesn't connect. The /32 mask confuses me as well, but I know that is what my subnet is because I see 255.255.255.255 in Windows as well (Please see post #4, you may get some idea). I'm not running in ad-hoc mode (you can see the output of iwconfig in the earlier post).

Remember that it actually works for me sometimes. It almost always works for about one or two seconds after I issue the commands I mentioned in the first post. Why it stops working is something I don't understand.

Also if there was a problem with the router, Windows and Ubuntu wouldn't have been able to connect right?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic routing visce Linux - Networking 1 12-07-2008 06:31 AM
changed from static to dynamic ip routing stopped pandersson61 Linux - Networking 10 07-15-2008 12:05 PM
Dynamic/Redundant Routing mattdyke Linux - Networking 5 01-04-2007 10:06 AM
dynamic routing kevin_5050 Linux - General 0 04-17-2001 07:36 AM
dynamic routing kevin_5050 Linux - Networking 0 04-16-2001 07:38 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 09:10 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration