aboutsummaryrefslogtreecommitdiff
path: root/dotfiles/cheat/sharing_internet
diff options
context:
space:
mode:
authorneodarz <neodarz@neodarz.net>2019-09-05 07:05:07 +0200
committerneodarz <neodarz@neodarz.net>2019-09-05 07:05:07 +0200
commite0c0d4b38cde20e2300e86b69414dd9851b47456 (patch)
tree5df65243447352a9637d1f783247bfd5ccff2ef4 /dotfiles/cheat/sharing_internet
parentdc45bf89a66ec6c8cd25cf5605deb853f6984705 (diff)
downloaddotfiles_dotdrop-e0c0d4b38cde20e2300e86b69414dd9851b47456.tar.xz
dotfiles_dotdrop-e0c0d4b38cde20e2300e86b69414dd9851b47456.zip
ooo
Diffstat (limited to 'dotfiles/cheat/sharing_internet')
-rw-r--r--dotfiles/cheat/sharing_internet44
1 files changed, 44 insertions, 0 deletions
diff --git a/dotfiles/cheat/sharing_internet b/dotfiles/cheat/sharing_internet
new file mode 100644
index 0000000..8dca3b5
--- /dev/null
+++ b/dotfiles/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
+