If I have a laptop with a 3G internet connection provided by a USB dongle is it fairly easy to allow other systems to use the internet connection via the laptop's ethernet port?
E.g. if I run something like dnsmasq on the laptop it can be a DHCP and DNS server so that anything connected (directly or via a switch) should work shouldn't it?
Or run squid if you only need to share web browsing and ftp.
Tim.
On 11 December 2012 18:36, Chris Green cl@isbd.net wrote:
If I have a laptop with a 3G internet connection provided by a USB dongle is it fairly easy to allow other systems to use the internet connection via the laptop's ethernet port?
E.g. if I run something like dnsmasq on the laptop it can be a DHCP and DNS server so that anything connected (directly or via a switch) should work shouldn't it?
-- Chris Green
main@lists.alug.org.uk http://www.alug.org.uk/ http://lists.alug.org.uk/mailman/listinfo/main Unsubscribe? See message headers or the web site above!
On 11 Dec 18:36, Chris Green wrote:
If I have a laptop with a 3G internet connection provided by a USB dongle is it fairly easy to allow other systems to use the internet connection via the laptop's ethernet port?
E.g. if I run something like dnsmasq on the laptop it can be a DHCP and DNS server so that anything connected (directly or via a switch) should work shouldn't it?
Ish... assuming that you're not using network manager ;)
If you are using network manager, you'll need to get it to ignore eth0 for a bit, then configure eth0 with a static ip in the range that you're going to serve with dnsmasq, fire up dnsmasq on eth0 (something like: dnsmasq --dhcp-range 192.168.92.10,192.168.92.250,255.255.255.0 -i eth0), you'll also need to turn on masquerading and ip forwarding, the simplest (and least secure, but fine for temporary measures), way to do this is:
sysctl net.ipv4.ip_forward=1 iptables -t nat -A POSTROUTING --source 192.168.92.0/24 -j MASQUERADE
Then bob should be your mums dads sons brother, or something.
On Wed, Dec 12, 2012 at 09:45:20AM +0000, Brett Parker wrote:
On 11 Dec 18:36, Chris Green wrote:
If I have a laptop with a 3G internet connection provided by a USB dongle is it fairly easy to allow other systems to use the internet connection via the laptop's ethernet port?
E.g. if I run something like dnsmasq on the laptop it can be a DHCP and DNS server so that anything connected (directly or via a switch) should work shouldn't it?
Ish... assuming that you're not using network manager ;)
Ah, yes! :-) I actually uninstalled Network Manager from the laptop and replaced it with wicd just recently.
If you are using network manager, you'll need to get it to ignore eth0 for a bit, then configure eth0 with a static ip in the range that you're going to serve with dnsmasq, fire up dnsmasq on eth0 (something like: dnsmasq --dhcp-range 192.168.92.10,192.168.92.250,255.255.255.0 -i
Similar to the set-up on my desktop machine (which is the DNS and DHCP server for my home LAN), it does have Network Manager but I've edited /etc/network/interfaces to make the desktop machine have a static address and I have stopped Network Manager running dnsmasq itself (which it does now by default).
I have (mostly) got the defaults for dnsmasq which seem to work pretty well so I'll do the same for the laptop when bridging (I'll need to have some easy way to turn it all on/off, maybe just a script that I run to turn it into a bridge).
eth0), you'll also need to turn on masquerading and ip forwarding, the simplest (and least secure, but fine for temporary measures), way to do this is: sysctl net.ipv4.ip_forward=1 iptables -t nat -A POSTROUTING --source 192.168.92.0/24 -j MASQUERADE
Then bob should be your mums dads sons brother, or something.
Ah, that last bit is something I'd forgotten was necessary, thanks. The router usually does it of course. I can add that bit to the 'switch on bridging' script as well.