Fixing nat and startup.sh scripts
[lede.git] / sentinel_setup / setup / startup.sh
1 #!/bin/sh
2
3 # Do IP mangling for checksum error issue after disable_dgaf=1
4 iptables -A POSTROUTING -t mangle -p udp --dport 68 -j CHECKSUM --checksum-fill
5
6 # Do block ARP from ESP8266 to itself to avoid DHCPDECLINE
7 arptables -A INPUT -j DROP --source-mac 18:fe:34:db:59:72 --destination-mac 18:fe:34:db:59:72
8 arptables -A OUTPUT -j DROP --source-mac 18:fe:34:db:59:72 --destination-mac 18:fe:34:db:59:72
9 arptables -A FORWARD -j DROP --source-mac 18:fe:34:db:59:72 --destination-mac 18:fe:34:db:59:72
10
11 # block everything except ssh, icmp, http, and dhcp
12 # Configure NAT
13 iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
14
15 # Protocol ICMP
16 iptables -A FORWARD -j ACCEPT -p icmp;
17 iptables -A INPUT -j ACCEPT -s 192.168.1.198 -d 192.168.1.1 -p icmp;
18 iptables -A INPUT -j ACCEPT -s 192.168.1.1 -d 192.168.1.198 -p icmp;
19 iptables -A OUTPUT -j ACCEPT -s 192.168.1.198 -d 192.168.1.1 -p icmp;
20 iptables -A OUTPUT -j ACCEPT -s 192.168.1.1 -d 192.168.1.198 -p icmp;
21
22 # SSH port 22
23 #iptables -A INPUT -j ACCEPT -s 192.168.1.198 -d 192.168.1.1 -p tcp --dport ssh;
24 #iptables -A INPUT -j ACCEPT -s 192.168.1.198 -d 192.168.1.1 -p tcp --sport ssh;
25 #iptables -A INPUT -j ACCEPT -s 192.168.1.1 -d 192.168.1.198 -p tcp --dport ssh;
26 #iptables -A INPUT -j ACCEPT -s 192.168.1.1 -d 192.168.1.198 -p tcp --sport ssh;
27 #iptables -A OUTPUT -j ACCEPT -s 192.168.1.198 -d 192.168.1.1 -p tcp --dport ssh;
28 #iptables -A OUTPUT -j ACCEPT -s 192.168.1.198 -d 192.168.1.1 -p tcp --sport ssh;
29 #iptables -A OUTPUT -j ACCEPT -s 192.168.1.1 -d 192.168.1.198 -p tcp --dport ssh;
30 #iptables -A OUTPUT -j ACCEPT -s 192.168.1.1 -d 192.168.1.198 -p tcp --sport ssh;
31 iptables -A INPUT -j ACCEPT -p tcp --dport ssh;                                
32 iptables -A INPUT -j ACCEPT -p tcp --sport ssh;
33 iptables -A OUTPUT -j ACCEPT -p tcp --dport ssh;                                
34 iptables -A OUTPUT -j ACCEPT -p tcp --sport ssh;
35
36 iptables -A FORWARD -j ACCEPT -p tcp --dport ssh;
37 iptables -A FORWARD -j ACCEPT -p tcp --sport ssh;
38
39 # DNS UDP and TCP port 53
40 iptables -A INPUT -j ACCEPT -p tcp --dport domain
41 iptables -A INPUT -j ACCEPT -p tcp --sport domain
42 iptables -A OUTPUT -j ACCEPT -p tcp --dport domain
43 iptables -A OUTPUT -j ACCEPT -p tcp --sport domain
44 iptables -A INPUT -j ACCEPT -p udp --dport domain
45 iptables -A INPUT -j ACCEPT -p udp --sport domain
46 iptables -A OUTPUT -j ACCEPT -p udp --dport domain
47 iptables -A OUTPUT -j ACCEPT -p udp --sport domain
48 # BOOTP Client port 68
49 iptables -A INPUT -j ACCEPT -p udp --dport bootpc
50 iptables -A INPUT -j ACCEPT -p udp --sport bootpc;
51 # BOOTP Server port 67
52 iptables -A OUTPUT -j ACCEPT -p udp --dport bootps
53 iptables -A OUTPUT -j ACCEPT -p udp --sport bootps;
54 iptables -A FORWARD -j REJECT
55 iptables -A INPUT -j REJECT
56 iptables -A OUTPUT -j REJECT
57
58 # bridge hairpin mode
59 #/usr/sbin/brctl hairpin br-wifi wlan0 on
60