Adding deletion of mangling rule before adding it back in startup.sh
[lede.git] / vigilia_setup / setup / startup.sh
1 #!/bin/sh
2
3 # Do IP mangling for checksum error issue after disable_dgaf=1
4 iptables -D POSTROUTING -t mangle -p udp --dport 68 -j CHECKSUM --checksum-fill
5 iptables -A POSTROUTING -t mangle -p udp --dport 68 -j CHECKSUM --checksum-fill
6
7 # block everything except ssh, icmp, http, and dhcp
8 # Configure NAT
9 iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
10
11 # Protocol ICMP
12 iptables -A FORWARD -j ACCEPT -p icmp;
13 iptables -A INPUT -j ACCEPT -p icmp;
14 iptables -A OUTPUT -j ACCEPT -p icmp;
15
16 # SSH port 22
17 # Note: 192.168.1.198 is the address of the master Raspberry Pi.
18 # So, please adjust it to your own setup if needed.
19 #iptables -A INPUT -j ACCEPT -s 192.168.1.198 -d 192.168.1.1 -p tcp --dport ssh;
20 #iptables -A INPUT -j ACCEPT -s 192.168.1.198 -d 192.168.1.1 -p tcp --sport ssh;
21 #iptables -A INPUT -j ACCEPT -s 192.168.1.1 -d 192.168.1.198 -p tcp --dport ssh;
22 #iptables -A INPUT -j ACCEPT -s 192.168.1.1 -d 192.168.1.198 -p tcp --sport ssh;
23 #iptables -A OUTPUT -j ACCEPT -s 192.168.1.198 -d 192.168.1.1 -p tcp --dport ssh;
24 #iptables -A OUTPUT -j ACCEPT -s 192.168.1.198 -d 192.168.1.1 -p tcp --sport ssh;
25 #iptables -A OUTPUT -j ACCEPT -s 192.168.1.1 -d 192.168.1.198 -p tcp --dport ssh;
26 #iptables -A OUTPUT -j ACCEPT -s 192.168.1.1 -d 192.168.1.198 -p tcp --sport ssh;
27 iptables -A INPUT -j ACCEPT -p tcp --dport ssh;                                
28 iptables -A INPUT -j ACCEPT -p tcp --sport ssh;
29 iptables -A OUTPUT -j ACCEPT -p tcp --dport ssh;                                
30 iptables -A OUTPUT -j ACCEPT -p tcp --sport ssh;
31
32 iptables -A FORWARD -j ACCEPT -p tcp --dport ssh;
33 iptables -A FORWARD -j ACCEPT -p tcp --sport ssh;
34
35 # DNS UDP and TCP port 53
36 iptables -A INPUT -j ACCEPT -p tcp --dport domain
37 iptables -A INPUT -j ACCEPT -p tcp --sport domain
38 iptables -A OUTPUT -j ACCEPT -p tcp --dport domain
39 iptables -A OUTPUT -j ACCEPT -p tcp --sport domain
40 iptables -A INPUT -j ACCEPT -p udp --dport domain
41 iptables -A INPUT -j ACCEPT -p udp --sport domain
42 iptables -A OUTPUT -j ACCEPT -p udp --dport domain
43 iptables -A OUTPUT -j ACCEPT -p udp --sport domain
44 # BOOTP Client port 68
45 iptables -A INPUT -j ACCEPT -p udp --dport bootpc
46 iptables -A INPUT -j ACCEPT -p udp --sport bootpc;
47 # BOOTP Server port 67
48 iptables -A OUTPUT -j ACCEPT -p udp --dport bootps
49 iptables -A OUTPUT -j ACCEPT -p udp --sport bootps;
50 iptables -A FORWARD -j REJECT
51 iptables -A INPUT -j REJECT
52 iptables -A OUTPUT -j REJECT
53
54 # bridge hairpin mode
55 #/usr/sbin/brctl hairpin br-wifi wlan0 on
56