1

I am trying to create a hotspot with a captive portal for my company. First thing I needed to do was share my internet access.

So, what I am trying to do is, have internet cable plugged into eth0, then make it accessible from eth1

eth0 is regular NIC, but eth1 is USB Ethernet

I did the following:

  1. edited "/etc/network/interfaces":

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

auto eth1
iface eth1 inet static
address 192.168.3.1
network 192.168.3.0
netmask 255.255.255.0

  1. restarted the networking service
  2. edited "/etc/sysctl.conf" and uncommented the following line:

net.ipv4.ip_forward=1

  1. I entered the following line to masquerade:

sudo iptables -A POSTROUTING -t nat -o eth0 -j MASQUERADE

=======================================================

  • When I type ifconfig

eth0 Link encap:Ethernet HWaddr xx:xx:xx:xx:xx:xx
inet addr:192.168.1.109 Bcast:192.168.1.255 Mask:255.255.255.0 inet6 addr: fe80::de4a:3eff:fef2:db6e/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:19 errors:0 dropped:0 overruns:0 frame:0 TX packets:49 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:2247 (2.2 KB) TX bytes:7133 (7.1 KB)

eth1 Link encap:Ethernet HWaddr xx:xx:xx:xx:xx:xx
inet addr:192.168.3.1 Bcast:192.168.3.255 Mask:255.255.255.0 inet6 addr: fe80::2e0:4cff:fe53:4458/64 Scope:Link UP BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:15 errors:1 dropped:0 overruns:0 frame:0 TX packets:72 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:901 (901.0 B) TX bytes:9214 (9.2 KB)

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:65536 Metric:1 RX packets:777 errors:0 dropped:0 overruns:0 frame:0 TX packets:777 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1 RX bytes:86369 (86.3 KB) TX bytes:86369 (86.3 KB)

  • when i type sudo iptables -t nat -L -v -n

Chain PREROUTING (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination

Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination

Chain OUTPUT (policy ACCEPT 2 packets, 118 bytes)
pkts bytes target prot opt in out source destination

Chain POSTROUTING (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
2 118 MASQUERADE all -- * eth0 0.0.0.0/0 0.0.0.0/0

Additional Info

  • My NICs had different names when I first installed Ubuntu, they were something like enp2s0 for eth0 and some long name for eth1, I changed their names.

  • One last thing I should mention, although I am not sure it is relevant, when I try to access my networks from "system settings" GUI, I get this error message "Did not find a connection with UUID '(null)'"

My problem is that I still can't access the internet from eth1, which is connected to linksys wireless router internet source plug. Any suggestion will be highly appreciated..

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.