I have been searching the fourm for information about how to set up my Raspberry Pi 3 with latest Raspbian Stretch OS installed as a simple 3G/4G router device.
It seems like the way of configuring the various network settings has changed in Stretch comparted to previous versions and the tuturials and guides I have seen has all refered to previous verisons - This is why I am creating this post.
My goal is to set up my Raspberry Pi 3 as a Router where the WAN device is my USB 3G/4G modem and LAN is the onboard ethernet port.
I am running a clean install of latest Stretch version and all files and setting are default.
Here is a copy of my ifconfig:
pi@raspberrypi:~ $ ifconfig
eth0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether b8:27:eb:e7:ad:17 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.8.100 netmask 255.255.255.0 broadcast 192.168.8.255
inet6 fe80::8c0d:f7bc:d498:cc8b prefixlen 64 scopeid 0x20<link>
ether 0c:5b:8f:27:9a:64 txqueuelen 1000 (Ethernet)
RX packets 99356 bytes 119500284 (113.9 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 54242 bytes 47232537 (45.0 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1 (Local Loopback)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wlan0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether b8:27:eb:b2:f8:42 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
ETH0 is the onboard LAN connector
ETH1 is the USB Modem
WLAN0 is the onboard WLAN adapter.
What I wanna do is to have the rpi act as a router for my local network and share the USB modem with all clients on the network.
As far as I understand from the guides found for the earlier versions of Raspbian, I need to do the following:
- Set a static IP address for the ETH0 interface
- Enable IP Forwarding
- Create IP Tables Rules
- Set up DHCP server for the ETH0 interface
I tried editing /etc/network/interfaces with this:
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.1.111
netmask 255.255.255.0
auto eth1
iface eth1 inet dhcp
When doing so, the eth0 gets the static ip address assigned but eth1 disappears from ifconfig.
Can someone point me in direction of which files to edit in the current stretch version to be able to configure the above ?
Thank you and have a great weekend !