Nastavení sítě

Nastavení sítě

vi /etc/network/interfaces

source /etc/network/interfaces.d/*
auto lo
iface lo inet loopback
auto ens3
iface ens3 inet static
 address 10.1.8.14
 network 10.1.8.0
 netmask 255.255.255.0
 gateway 10.1.8.1
dns-nameservers 10.1.8.14
 dns-search cesal.cz
pre-up iptables-restore < /etc/iptables.rules

 

vi /etc/iptables.rules

# IPTables rules
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -p icmp --icmp-type 8 -s 0/0 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
-A OUTPUT -p icmp --icmp-type 0 -d 0/0 -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -m state --state NEW -p tcp -m tcp --dport 53 -j ACCEPT
-A INPUT -m state --state NEW -p udp -m udp --dport 53 -j ACCEPT
-A INPUT -m state --state NEW -p tcp -m tcp --dport 54 -j ACCEPT
-A INPUT -m state --state NEW -p udp -m udp --dport 54 -j ACCEPT
-A INPUT -j DROP
-A FORWARD -j DROP
COMMIT
*nat
:PREROUTING ACCEPT [0:0]
:INPUT ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
# -A PREROUTING -p tcp -s 10.0.0.0/8 --dport 53 -j REDIRECT --to-port 54
# -A PREROUTING -p udp -s 10.0.0.0/8 --dport 53 -j REDIRECT --to-port 54
COMMIT