Internet Connection Sharing in ubuntu

etherion

Active Member
Joined
Dec 13, 2011
Messages
38
Hi Guys
I've having trouble setting up an ICS with my other computer.
I've followed the instructions @ https://help.ubuntu.com/community/Internet/ConnectionSharing but still no luck.
I'm using /etc/network/interface to handle my connection so i used the Ubuntu Internet Gateway Method (iptables)
wlan0 is directly connected to the internet and i would like eth0 to be the wired shared connection.
So following the guide: * subnet is 192.168.1.x

Configure your internal network card (eth0) for static IP like so:
1) sudo ip addr add 192.168.1.1/24 dev wlan0

Configure NAT
2)sudo iptables -A FORWARD -o wlan0 -i eth0 -s 192.168.1.0/24 -m conntrack --ctstate NEW -j ACCEPT
sudo iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
sudo iptables -A POSTROUTING -t nat -j MASQUERADE

Save iptables rules
3)sudo iptables-save | sudo tee /etc/iptables.sav

Modify /etc/rc.local file
4)iptables-restore < /etc/iptables.sav

configure routing between two interfaces
5)sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"

edit /etc/sysctl.conf
6)net.ipv4.conf.default.forwarding=1
net.ipv4.conf.all.forwarding=1


Client Setup *do i input these steps into the client machine or host??
1)sudo /etc/init.d/networking stop
2)sudo ip addr add 192.168.1.100/24 dev wlan0
3)sudo ip route add default via 192.168.1.1

So i followed these steps, but since i'm using /etc/network/interfaces what shoud i put in that file for eth0?
auto eth0
iface eth0 inet static
address ??
netmask 255.255.255.0

do i need to add any more??
 

ponder

Honorary Master
Joined
Jan 22, 2005
Messages
92,823
You can not have two interfaces in the same network/subnet, just keep that in mind.

What are the addresses configured on your interfaces?
 

etherion

Active Member
Joined
Dec 13, 2011
Messages
38
wlan0 is configured on 192.168.1.xxx on a dhcp.
I've not configured eth0 as i am not sure what to put in
about the two interface not on the same network/subnet if wlan0 is on 192.168.1.x should eth0 be on 192.1168.0.xx or what
 

etherion

Active Member
Joined
Dec 13, 2011
Messages
38
ok, so i've followed the instructiions again
Host=wlan0 is on 192.168.1.x
client eth0 is on 192.168.0.x

so for the host will the /etc/network/interface file look like this
auto eth0
iface eth0 inet static
address 192.168.0.xx
netmask 255.255.255.0
gateway 192.168.0.1

then for the client machine will the interface file look the same?
 
Top