diff options
Diffstat (limited to 'cheat/.cheat/sharing_internet')
-rw-r--r-- | cheat/.cheat/sharing_internet | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/cheat/.cheat/sharing_internet b/cheat/.cheat/sharing_internet new file mode 100644 index 0000000..8dca3b5 --- /dev/null +++ b/cheat/.cheat/sharing_internet @@ -0,0 +1,44 @@ +# First connect machines ! + +# Enable port fowrading +sysctl net.ipv4.ip_forward=1 + +# fowrwarding Wifi -> Ethernet +iptables -t nat -A POSTROUTING -o internet0 -j MASQUERADE +iptables -A FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT +iptables -A FORWARD -i net0 -o internet0 -j ACCEPT + +# First setup of device +sudo ip link set up dev enp0s25 +sudo ip addr add 192.168.2.100/24 dev enp0s25 # arbitrary address + +# /etc/dhcpd.conf +option domain-name-servers 80.67.169.12, 80.67.169.40; +option subnet-mask 255.255.255.0; +option routers 192.168.4.100; +subnet 192.168.4.0 netmask 255.255.255.0 { + range 192.168.4.150 192.168.4.250; + + host fenec { + hardware ethernet 5c:ff:35:09:ac:6a; + fixed-address 192.168.4.100; + } + +} + +# Service +# /etc/systemd/system/dhcpd4@.service +[Unit] +Description=IPv4 DHCP server on %I +Wants=network.target +After=network.target + +[Service] +Type=forking +PIDFile=/run/dhcpd4.pid +ExecStart=/usr/bin/dhcpd -4 -q -pf /run/dhcpd4.pid %I +KillSignal=SIGINT + +[Install] +WantedBy=multi-user.target + |