internet ---- router linksys ---- debian ----- siec lokalna
Fajnie otrzymuje adres od DEBIANA widze wszystkie zasoby udostepnione po sambie i sshowac sie moge. Lokalnie jest wszystko ok. Niestety dostepu do netu nie mam.
Pozwole sobie zamiescic zawartosc trzech plikow moze ktos mi pomoze.
/etc/dhcp3/dhcp.conf
Kod: Zaznacz cały
ddns-update-style none;
option domain-name "32wrz.com";
option domain-name-servers ns1.32rz.com, ns2.32wrz.com;
default-lease-time 86400;
max-lease-time 604800;
log-facility local7;
subnet 192.168.0.0 netmask 255.255.255.0 {
ddns-domainname "22wrz.com";
option subnet-mask 255.255.255.0;
option routers 192.168.0.1;
option broadcast-address 192.168.0.255;
option domain-name-servers 194.168.0.1;
option domain-name "22wrz.com";
range 192.168.0.6 192.168.0.10;
}
host toshiba {
hardware ethernet 00:a0:d1:66:d9:6c;
update-static-leases on;
fixed-address 192.168.0.5;
option host-name "toshiba";
}
Kod: Zaznacz cały
auto lo
iface lo inet loopback
# The primary network interface
allow-hotplug eth0
iface eth0 inet dhcp
allow-hotplug eth1
iface eth1 inet static
address 192.168.0.1
netmask 255.255.255.0
##broadcast 192.168.0.255
##dns-search 32wrz.com
##dns-domain 32wrz.com
Kod: Zaznacz cały
#!/bin/sh
test -x $FIREWALL || exit 0
. /lib/lsb/init-functions
if [ "$(id -u)" != "0" ]
then
log_failure_msg "You must be root to start, stop or restart firewall."
exit 1
fi
start () {
log_daemon_msg "Starting firewall rules"
#echo "1" > /proc/sys/net/ipv4/ip_forward
# clean table
iptables -F INPUT
iptables -F OUTPUT
iptables -F FORWARD
# policy
iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT
iptables -P FORWARD DROP
# nat
#iptables -F -t nat
#iptables -X -t nat
#iptables -F -t filter
#iptables -X -t filter
# Odrzucenie i brak zezwolenia na forwardowanie pakietow
iptables -t filter -P FORWARD DROP
# Przepuszczanie pakietow z sieci lub przeznaczone dla sieci
#iptables -t filter -A FORWARD -s 10.10.1.0/255.255.255.0 -d 0/0 -j ACCEPT
#iptables -t filter -A FORWARD -s 0/0 -d 10.10.1.0/255.255.255.0 -j ACCEPT
# Udostepanianie Internetu przez Maskarade
iptables -t nat -A POSTROUTING -s 192.168.0.5 -j MASQUERADE
iptables -A FORWARD -m mac --mac-source 00:a0:d1:66:d9:6c -j ACCEPT
# rules (public)
iptables -A INPUT -m state --state NEW -j ACCEPT
iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -p icmp -j ACCEPT
iptables -A INPUT -p udp --dport 53 -j ACCEPT # bind
iptables -A INPUT -p tcp --dport 25 -j ACCEPT # postfix
iptables -A INPUT -p tcp --dport 110 -j ACCEPT # postfix
iptables -A INPUT -p udp --dport 25 -j ACCEPT # postfix
iptables -A INPUT -p udp --dport 110 -j ACCEPT # postfix
iptables -A INPUT -p tcp --dport 49160:49300 -j ACCEPT # torrents
iptables -A INPUT -p udp --dport 49160:49300 -j ACCEPT # torrents
iptables -A INPUT -p tcp --dport 22 -j ACCEPT # ssh
iptables -A INPUT -p tcp --dport 445 -j ACCEPT # samba
iptables -A INPUT -p tcp --dport 137:139 -j ACCEPT # netbios
iptables -A INPUT -p tcp --dport 80 -j ACCEPT # http
iptables -A INPUT -p tcp --dport 631 -j ACCEPT # http cups
iptables -A INPUT -p tcp --dport 9100 -j ACCEPT # drukarka
log_end_msg $?
return $?
}
stop () {
log_daemon_msg "Brutal stop of firewall rules !!!"
# clean table
iptables -F INPUT
iptables -F OUTPUT
iptables -F FORWARD
# drop all ;)
iptables -P INPUT DROP
iptables -P OUTPUT DROP
iptables -P FORWARD DROP
# rules
#iptables -A INPUT -p tcp -s 10.10.1.10/255.255.255.0 --dport 22 -j ACCEPT
#iptables -A OUTPUT -p tcp -d 10.10.1.10/255.255.255.0 --sport 22 -j ACCEPT
log_end_msg $?
return $?
}
status () {
iptables -L
return $?
}
case "$1" in
start)
start || exit 1
;;
stop)
stop || exit 1
;;
restart)
start || exit 1
;;
status)
status || exit 1
;;
*)
echo "Usage: /etc/init.d/firewall {start|stop|restart|status}"
exit 1
esac
exit 0