I'm currently working on a project of making an highly secured router with my RaspberryPi to navigate anonymously on the net. Yet, I'm not able to correctly transfer the Internet connection to the new server:
pi@raspberrypi:~ $ sudo iptables -t nat -A FORWARD -i eth0 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables: No chain/target/match by that name.
After some research on the message error: It seems that maybe I forget to compile the module or forget to do a depmod
(but I don't understand what does that mean...)
Indeed I did:
- SSH connection to my Raspberry Pi: ssh [user]@[IP address]
- installed the Dynamic Host Configuration Protocol sudo get-apt install hstapd isc-dhcp-server
- configured DHCP by adding a # to the two options about domain name and suppressing # in front of the authoritative option seven lines under
adding
subnet 192.168.42.0 netmask 255.255.255.0 { range 192.168.42.10 192.168.42.50; option broadcast-adress 192.168.42.255; option routers 192.168.42.1; default-lease-time 600; max-lease-time 7200; option domain-name "local"; option domain-name-servers 8.8.8.8, 8.8.4.4; }
to the file and saving it,
- modified the DHCP server settings in order to be able to use it with a wireless adaptor: Interfaces ="wlan0"
- set the Wifi adaptator with a static address an enabling it to receive incoming signals sudo nano /etc/network/interfaces adding a # to iface wlan 0 and to the following lines abiut anything connectod to wlan0
Gived to the interface a static IP address:
iface wlan0 inet static address 192.168.XX.X netmask 255.255.255.0
saving.
- Assign the wlan0 address 192.168.XX.X
- creating the WLAN and configurating it
- Modifying the Hostapd
- Configurationg a NAT to do the network rooting.
Finally executing the two following commands to be sure that the connection has actually correctly been transfered:
pi@raspberrypi:~ $ sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
pi@raspberrypi:~ $ sudo iptables -t nat -A FORWARD -i eth0 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT iptables: No chain/target/match by that name.
dmesg | grep eth
. You'll see something like this:eth0 was changed to eth2
. Then edit/etc/network/interfaces
and change eth0 to eth2.:~ $ dmesg | grep eth [ 3.745981] smsc95xx 1-1.1:1.0 eth0: register 'smsc95xx' at usb-3f980000.usb-1.1, smsc95xx USB 2.0 Ethernet, b8:27:eb:c7:c5:66 [ 10.949785] smsc95xx 1-1.1:1.0 eth0: hardware isn't capable of remote wakeup [ 10.950104] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready [ 12.529612] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready [ 12.530777] smsc95xx 1-1.1:1.0 eth0: link up, 100Mbps, full-duplex, lpa 0xC5E1
So I changediface eth0 inet manual
toiface eth2 inet manual
but still I have the problem...eth0: link becomes ready
, so it should connect to the internet. Remove the static address and netmask, and try again.