Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have an ubuntu server, which automatically connects to a wireless network on startup. This is achieved through /etc/network/interfaces:

auto lo
iface lo inet loopback

auto wlan0
iface wlan0 inet dhcp
pre-up wpa_supplicant [...]
post-down sudo killall [...]

However, I would like the machine to act also as a dhcp server when somebody plugs in a cable. I installed dhcp3-server, and then configured /etc/network/interfaces by adding:

auto eth0
iface eth0 inet static
  address 10.0.0.1
  netmask 255.255.255.0
  network 10.0.0.0/25
  gateway 10.0.0.1

However, Internet is now unreachable, as the machine tries (me thinks) to connect through eth0 rather than wlan0.

How do I configure a machine to have both wireless internet access, and acting as a wired dhcp server?

EDIT: attached requested output.

ifconfig -a

eth0      Link encap:Ethernet  HWaddr [...]  
          inet addr:10.0.0.1  Bcast:10.0.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)
          Interrupt:17 

lo        Link encap:Local Loopback  
          [...]

wlan0     Link encap:Ethernet  HWaddr [...]  
          inet addr:10.7.0.213  Bcast:10.7.255.255  Mask:255.255.0.0
          inet6 addr: fe80::21c:bfff:fe36:cea7/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1368 errors:0 dropped:0 overruns:0 frame:0
          TX packets:66 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:267437 (267.4 KB)  TX bytes:9606 (9.6 KB)

rounte -n

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         10.0.0.1        0.0.0.0         UG    100    0        0 eth0
10.0.0.0        0.0.0.0         255.255.255.0   U     0      0        0 eth0
10.7.0.0        0.0.0.0         255.255.0.0     U     0      0        0 wlan0
share|improve this question
    
please add the result of ifconfig -a and route -n it will hel us UNDERSTAND THE PROBLEM; –  Kiwy Feb 28 at 9:25
    
sorry for the capital letters, it's a mistake not a shout. –  Kiwy Feb 28 at 9:53

1 Answer 1

up vote 2 down vote accepted

What if you try

route del default gw 10.0.0.1
route add default gw 10.7.0.1

It will use your old gw as your new default gateway. Those settings will be reset after a reboot.

share|improve this answer
    
This works! I have to work out how to automate that however. Thank you. –  astabada Feb 28 at 10:05

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.