aboutsummaryrefslogtreecommitdiff
path: root/cheat/.cheat/sharing_internet
blob: 8dca3b5018ec5b88ab593f14e06cb4b0cf2641f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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