Restarting network on boot

Soldato
Joined
1 Mar 2003
Posts
5,508
Location
Cotham, Bristol
Hi Guys,

I'm wanting my linux machine to set it's network settings during boot, so I've done the following

Changed my /etc/network/interfaces to
Code:
auto lo
iface lo inet loopback

auto wlan0
iface wlan0 inet static
wireless-essid xxxxxx
wireless-key xxxxxxxxxxxx
wireless-channel 13
address 192.168.0.3
netmask 255.255.255.0
gateway 192.168.0.1

Created a script like so
Code:
sudo gedit /etc/init.d/wireless-network

With this content
Code:
/etc/init.d/networking restart

Set it's permissions
Code:
sudo chmod +x /etc/init.d/wireless-network

Created a symbolic link
Code:
sudo ln -s /etc/init.d/wireless-network /etc/rcS.d/S40wireless-network

Rebooted
Code:
reboot

Ok so it boots up ok and it's sitting on the login screen, when I try to ping it however it doesn't reply! What's wrong??

Thanks,
Paul
 
So I did a bit of debugging of my script and my re-directed output looks like. Did an ifconfig as well

Code:
 * Reconfiguring network interfaces...
   ...done.
eth0      Link encap:Ethernet  HWaddr 00:01:2e:27:bc:92  
          UP BROADCAST MULTICAST  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:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:22 Base address:0x4000 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  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)

So when it runs the script, wlan0 hasn't registered yet, suggestions?
 
Last edited:
Well I changed the script to this

Code:
date > /home/paul/debug_script.txt
ifconfig wlan0 >> /home/paul/debug_script.txt
/etc/init.d/networking restart >> /home/paul/debug_script.txt
ifconfig wlan0 >> /home/paul/debug_script.txt
echo "PINGING ROUTER" >> /home/paul/debug_script.txt
ping -c 6 192.168.0.1 >> /home/paul/debug_script.txt
echo "PINGING GOOGLE" >> /home/paul/debug_script.txt
ping -c 6 www.google.com >> /home/paul/debug_script.txt

And now I get this output

Code:
Mon Apr 19 21:54:36 BST 2010
wlan0     Link encap:Ethernet  HWaddr 00:1b:2f:cd:a0:b9  
          inet addr:192.168.0.3  Bcast:192.168.0.255  Mask:255.255.255.0
          BROADCAST RUNNING MULTICAST  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:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

 * Reconfiguring network interfaces...
   ...done.
wlan0     Link encap:Ethernet  HWaddr 00:1b:2f:cd:a0:b9  
          inet addr:192.168.0.3  Bcast:192.168.0.255  Mask:255.255.255.0
          UP BROADCAST MULTICAST  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:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

PINGING ROUTER
PING 192.168.0.1 (192.168.0.1) 56(84) bytes of data.
From 192.168.0.3 icmp_seq=1 Destination Host Unreachable
From 192.168.0.3 icmp_seq=2 Destination Host Unreachable
From 192.168.0.3 icmp_seq=3 Destination Host Unreachable
From 192.168.0.3 icmp_seq=4 Destination Host Unreachable
From 192.168.0.3 icmp_seq=5 Destination Host Unreachable
From 192.168.0.3 icmp_seq=6 Destination Host Unreachable

--- 192.168.0.1 ping statistics ---
6 packets transmitted, 0 received, +6 errors, 100% packet loss, time 5031ms
, pipe 3
PINGING GOOGLE
 
Back
Top Bottom