LINUX.ORG.RU

Сообщения n19ht

 

iptables firewall для роутера

Здравствуйте, решил изучить iptables ну и попробовать собрать файрвол :) Ну как говорится первый раз всегда комом... Вообщем вроде бы всё работает за исключением utorrenta (качать - качает, а вот раздавать не хочет). Я конечно же прописывал PREROUTING для него, но не помогает - где-то, что-то мешает. Собственно прошу помочь найти в чём проблема и вообще направить на путь истинный в плане файрвола ну т.е. что лишнее, а что лучше добавить(чё там я нагородил уже сам даже начинаю путаться).

#iptables -vnL

Chain INPUT (policy DROP 4 packets, 304 bytes)
 pkts bytes target     prot opt in     out     source             destination
    0     0 drop-and-log-it  all  --  ppp0   *       127.0.0.0/8          0.0.0.0/0
    0     0 drop-and-log-it  all  --  ppp0   *       192.168.0.0/16       0.0.0.0/0
    0     0 drop-and-log-it  all  --  ppp0   *       172.16.0.0/12        0.0.0.0/0
    0     0 drop-and-log-it  all  --  ppp0   *       10.0.0.0/8           0.0.0.0/0
   41  4103 drop-and-log-it  tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp flags:!0x17/0x02 state NEW
   16   896 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:80 flags:0x17/0x02
  467 34562 ACCEPT     tcp  --  *      *       192.168.10.0/24      192.168.10.0/24     multiport dports 22,139,445
 3520  156K drop-and-log-it  tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp flags:0x17/0x02
    0     0 drop-and-log-it  all  -f  *      *       0.0.0.0/0            0.0.0.0/0
    0     0 drop-and-log-it  tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp flags:0x3F/0x3F
    8   480 drop-and-log-it  tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp flags:0x3F/0x00
 3574  261K ACCEPT     all  --  lo     *       0.0.0.0/0            0.0.0.0/0
   65  9221 ACCEPT     all  --  eth1   *       192.168.10.0/24      0.0.0.0/0
    0     0 drop-and-log-it  all  --  ppp0   *       192.168.10.0/24      0.0.0.0/0
 1811 76730 ACCEPT     all  --  ppp0   *       0.0.0.0/0            212.3.132.78        state RELATED,ESTABLISHED
 1126  111K drop-and-log-it  all  --  *      *       0.0.0.0/0            0.0.0.0/0

Chain FORWARD (policy DROP 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination
13843 2749K ACCEPT     all  --  ppp0   eth1    0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED
18716 2176K ACCEPT     all  --  eth1   ppp0    0.0.0.0/0            0.0.0.0/0
 2267  112K drop-and-log-it  all  --  *      *       0.0.0.0/0            0.0.0.0/0

Chain OUTPUT (policy DROP 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination
 7121  418K ACCEPT     all  --  *      lo      0.0.0.0/0            0.0.0.0/0
   74  6176 ACCEPT     all  --  *      eth1    212.3.132.78         192.168.10.0/24
  478 73768 ACCEPT     all  --  *      eth1    192.168.10.0/24      192.168.10.0/24
    0     0 drop-and-log-it  all  --  *      ppp0    0.0.0.0/0            192.168.10.0/24
 5230  400K ACCEPT     all  --  *      ppp0    212.3.132.78         0.0.0.0/0
    1   123 drop-and-log-it  all  --  *      *       0.0.0.0/0            0.0.0.0/0

Chain drop-and-log-it (14 references)
 pkts bytes target     prot opt in     out     source               destination
 6963  383K LOG        all  --  *      *       0.0.0.0/0            0.0.0.0/0           LOG flags 0 level 6
 6963  383K REJECT     all  --  *      *       0.0.0.0/0            0.0.0.0/0           reject-with icmp-port-unreachable

и собственно сам файрвол:


#!/bin/sh

echo -e "\n\nSETTING UP IPTABLES FIREWALL..."

INTIF="eth1"
INTNET="192.168.10.0/24"
INTIP="192.168.10.1/24"

EXTIF="ppp0"
EXTIP="212.3.132.78"

UNIVERSE="0.0.0.0/0"

echo "Loading required stateful/NAT kernel modules..."

/sbin/depmod -a
/sbin/modprobe ip_tables
/sbin/modprobe ip_conntrack
/sbin/modprobe ip_conntrack_ftp
/sbin/modprobe ip_conntrack_irc
/sbin/modprobe iptable_nat
/sbin/modprobe ip_nat_ftp
/sbin/modprobe ip_nat_irc

echo "    Enabling IP forwarding..."
echo "1" > /proc/sys/net/ipv4/ip_forward

echo "    External interface: $EXTIF"
echo "       External interface IP address is: $EXTIP"
echo "    Loading firewall server rules..."


iptables -P INPUT DROP
iptables -F INPUT
iptables -P OUTPUT DROP
iptables -F OUTPUT
iptables -P FORWARD DROP
iptables -F FORWARD
iptables -F -t nat

if [ "`iptables -L | grep drop-and-log-it`" ]; then
   iptables -F drop-and-log-it
fi

iptables -X
iptables -Z

iptables -N drop-and-log-it
iptables -A drop-and-log-it -j LOG --log-level info
iptables -A drop-and-log-it -j REJECT

echo -e "     - Loading INPUT rulesets"

iptables -A INPUT -p TCP ! --syn -m state --state NEW -j drop-and-log-it
iptables -A INPUT -p tcp --syn --destination-port 80 -j ACCEPT
iptables -A INPUT -s $INTNET -p tcp -d $INTIP -m multiport --dport 22,139,445 -j ACCEPT
iptables -A INPUT -p TCP --syn -j drop-and-log-it
iptables -A INPUT -f -j drop-and-log-it
iptables -A INPUT -p tcp --tcp-flags ALL ALL -j drop-and-log-it
iptables -A INPUT -p tcp --tcp-flags ALL NONE -j drop-and-log-it
iptables -I INPUT -i ppp0 -s 10.0.0.0/8 -j drop-and-log-it
iptables -I INPUT -i ppp0 -s 172.16.0.0/12 -j drop-and-log-it
iptables -I INPUT -i ppp0 -s 192.168.0.0/16 -j drop-and-log-it
iptables -I INPUT -i ppp0 -s 127.0.0.0/8 -j drop-and-log-it

iptables -A INPUT -i lo -s $UNIVERSE -d $UNIVERSE -j ACCEPT
iptables -A INPUT -i $INTIF -s $INTNET -d $UNIVERSE -j ACCEPT
iptables -A INPUT -i $EXTIF -s $INTNET -d $UNIVERSE -j drop-and-log-it
iptables -A INPUT -i $EXTIF -s $UNIVERSE -d $EXTIP -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -s $UNIVERSE -d $UNIVERSE -j drop-and-log-it


echo -e "     - Loading OUTPUT rulesets"

iptables -A OUTPUT -o lo -s $UNIVERSE -d $UNIVERSE -j ACCEPT
iptables -A OUTPUT -o $INTIF -s $EXTIP -d $INTNET -j ACCEPT
iptables -A OUTPUT -o $INTIF -s $INTIP -d $INTNET -j ACCEPT
iptables -A OUTPUT -o $EXTIF -s $UNIVERSE -d $INTNET -j drop-and-log-it
iptables -A OUTPUT -o $EXTIF -s $EXTIP -d $UNIVERSE -j ACCEPT
iptables -A OUTPUT -s $UNIVERSE -d $UNIVERSE -j drop-and-log-it


echo -e "     - Loading FORWARD rulesets"

iptables -A FORWARD -i $EXTIF -o $INTIF -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -i $INTIF -o $EXTIF -j ACCEPT
iptables -A FORWARD -j drop-and-log-it

iptables -t nat -A POSTROUTING -o $EXTIF -j SNAT --to $EXTIP

iptables -t nat -A PREROUTING -p TCP --dport 28646 -i $EXTIF -j DNAT --to 192.168.10.2

echo -e "    Firewall server rule loading complete\n\n"

n19ht
()

samba linux+win7

Здравствуйте,
В сетевом окружении win7 не вижу мой линукс комп с samba. Через run -> //192.168.10.1 всё работает, но хочется видеть комп в сетевом окружении :(
smb.conf:

[global]
workgroup = WORKGROUP
server string = coolserver
netbios name = ntfw
dns proxy = no
os level = 65
domain master = no
interfaces = 192.168.10.1/24
bind interfaces only = yes
log file = /var/log/samba/log.%m
max log size = 1000
syslog = 0
panic action = /usr/share/samba/panic-action %d
security = user
encrypt passwords = true
passdb backend = tdbsam
obey pam restrictions = yes
unix password sync = yes
passwd program = /usr/bin/passwd %u
passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n$
pam password change = yes

[allusers]
comment = Public Stuff
path = /home/share/allusers
public = yes
writable = yes

[homes]
comment = Home Directories
browseable = no
writable = yes

собственно помогите пожалуйста сделать так, чтоб комп отображался в сетевом окружении win7.

n19ht
()

Debian lenny router + adsl bridge modem

Здравствуйте, Есть Debian lenny (первый компьютер) с 2умя сетевыми eth0 и eth1 - /etc/network/interfaces:

auto lo iface lo inet loopback

auto eth0 iface eth0 inet static address 192.168.1.2 netmask 255.255.255.0 gateway 192.168.1.1

auto eth1 iface eth1 inet static address 192.168.10.1 netmask 255.255.255.0

iface dsl-provider inet ppp pre-up /sbin/ifconfig eth0 up provider dsl-provider

второй компьютер - /etc/network/interfaces:

auto lo iface lo inet loopback

auto eth0 iface eth0 inet static address 192.168.10.2 netmask 255.255.255.0 gateway 192.168.10.1

ADSL модем настроен в режиме bridge. На первой машине инет работает, а на второй соответственно нет(локальная сеть между машинами работает). Я нигде не могу найти ничего по поводу настроек linux роутера с АДСЛ bridge модемом. Помогите пожалуйста прописать маршрутизацию, чтоб на второй машине инет тоже работал.

n19ht
()

RSS подписка на новые темы