Nie jesteś zalogowany.
Jeśli nie posiadasz konta, zarejestruj je już teraz! Pozwoli Ci ono w pełni korzystać z naszego serwisu. Spamerom dziękujemy!
Prosimy o pomoc dla małej Julki — przekaż 1% podatku na Fundacji Dzieciom zdazyć z Pomocą.
Więcej informacji na dug.net.pl/pomagamy/.
oczywiscie na wstepie zaznaczam ze znam artykul:
http://www.dug.net.pl/faq/index.php?kat=3&id=38
ale jakos on mi wogole nie pomaga :|
ustawienia w iptables
iptables -t nat PREROUTING -d 83.13.47.43 -j DNAT --to 192.168.0.2
iptables -t nat POSTROUTING -s 192.168.0.2 -j --to-source 83.13.47.43
/etc/network/interfaces
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth1
iface eth1 inet static
address 83.13.47.42
eth 1:0 83.13.47.43
netmask 255.255.255.248
gateway 83.13.47.41
# dns-* options are implemented by the resolvconf package, if installed
dns-nameservers 194.204.159.1 194.204.152.34
auto eth0
iface eth0 inet static
address 192.168.0.1
netmask 255.255.255.0
ipki w zakresie od 42 do 46 ale narazie chcialem sprobowac z jednym i i tak nie dziala :( pomozcie dobrzy ludzie w jakis lopatologiczny sposob bo juz zaczynam wlosy z glwy wyrywac
pozdrawiam
Offline
eth 1:0 83.13.47.43
zmień na
eth1:0 83.13.47.43[/quote]
spacja Ci sie wkradła.
Pozdrawiam
Offline
nietety dalej nie dziala :( macie moze jeszcze jakies pomysly gdzie jest blad ?
Offline
zobacz przez
ip addr show dev eth1
czy masz przypisane obydwa adresy ip do interfejsu, jezeli nie to:
ip addr add dev eth1 83.13.47.43/29 brd 83.13.47.47 scope global
ponadto w tym
iptables -t nat PREROUTING -d 83.13.47.43 -j DNAT --to 192.168.0.2
iptables -t nat POSTROUTING -s 192.168.0.2 -j --to-source 83.13.47.43 [/quote]
sa jakies braki :D, mam nadzieje ze to tylko przeoczenieKod:
iptables -t nat PREROUTING -d 83.13.47.43 -j DNAT --to-destination 192.168.0.2 iptables -t nat POSTROUTING -s 192.168.0.2 -j SNAT --to-source 83.13.47.43wklej jeszcze firewalla, moze tem jest gdzies problem
Nie ma nie idzie... jest nie umiem.
Offline
troche duzo tego bedzie :|
echo 1 > /proc/sys/net/ipv4/ip_forward iptables -F iptables -X iptables -t nat -X iptables -t nat -F iptables -P INPUT DROP iptables -P FORWARD DROP iptables -P OUTPUT ACCEPT iptables -A FORWARD -j ACCEPT -m state --state ESTABLISHED,RELATED iptables -A OUTPUT -j ACCEPT -m state --state ESTABLISHED,RELATED iptables -A INPUT -j ACCEPT -m state --state ESTABLISHED,RELATED iptables -A INPUT -i lo -j ACCEPT iptables -A FORWARD -o lo -j ACCEPT #zewnetrzne ip iptables -t nat PREROUTING -d 83.13.47.43 -j DNAT --to-destination 192.168.0.2 iptables -t nat POSTROUTING -s 192.168.0.2 -j SNAT --to-source 83.13.47.43 #konfiguracja do statystyk lstat #!/bin/sh IPTABLES=/sbin/iptables #local adresses LOCALNET=192.168.0.0/100 #external IP address EXT_IP=83.13.47.42 EXT_INTERFACE=eth1 INT_IP=192.168.0.1 INT_INTERFACE=eth0 #IP hosts to monitor HOST1=192.168.0.2 HOST2=192.168.0.3 HOST3=192.168.0.4 HOST4=192.168.0.5 HOST5=192.168.0.6 HOST6=192.168.0.9 HOST7=192.168.0.16 HOST8=192.168.0.40 HOST9=192.168.0.50 HOST10=192.168.0.8 #set masq for outgoing packets (may require load some modules) $IPTABLES -t nat -A POSTROUTING -o $EXT_INTERFACE -j SNAT --to-source $EXT_IP #create chain for statistic $IPTABLES -N lstat #add rules for host1 $IPTABLES -A lstat -i $INT_INTERFACE -s $HOST1 -j ACCEPT $IPTABLES -A lstat -m state --state ESTABLISHED,RELATED -d $HOST1 -j ACCEPT #add rules for host2 $IPTABLES -A lstat -i $INT_INTERFACE -s $HOST2 -j ACCEPT $IPTABLES -A lstat -m state --state ESTABLISHED,RELATED -d $HOST2 -j ACCEPT #add rules for host3 $IPTABLES -A lstat -i $INT_INTERFACE -s $HOST3 -j ACCEPT $IPTABLES -A lstat -m state --state ESTABLISHED,RELATED -d $HOST3 -j ACCEPT #add rules for host4 $IPTABLES -A lstat -i $INT_INTERFACE -s $HOST4 -j ACCEPT $IPTABLES -A lstat -m state --state ESTABLISHED,RELATED -d $HOST4 -j ACCEPT #add rules for host5 $IPTABLES -A lstat -i $INT_INTERFACE -s $HOST5 -j ACCEPT $IPTABLES -A lstat -m state --state ESTABLISHED,RELATED -d $HOST5 -j ACCEPT #add rules for host6 $IPTABLES -A lstat -i $INT_INTERFACE -s $HOST6 -j ACCEPT $IPTABLES -A lstat -m state --state ESTABLISHED,RELATED -d $HOST6 -j ACCEPT #add rules for host7 $IPTABLES -A lstat -i $INT_INTERFACE -s $HOST7 -j ACCEPT $IPTABLES -A lstat -m state --state ESTABLISHED,RELATED -d $HOST7 -j ACCEPT #add rules for host8 $IPTABLES -A lstat -i $INT_INTERFACE -s $HOST8 -j ACCEPT $IPTABLES -A lstat -m state --state ESTABLISHED,RELATED -d $HOST8 -j ACCEPT #add rules for host9 $IPTABLES -A lstat -i $INT_INTERFACE -s $HOST9 -j ACCEPT $IPTABLES -A lstat -m state --state ESTABLISHED,RELATED -d $HOST9 -j ACCEPT #add rules for host10 $IPTABLES -A lstat -i $INT_INTERFACE -s $HOST10 -j ACCEPT $IPTABLES -A lstat -m state --state ESTABLISHED,RELATED -d $HOST10 -j ACCEPT #set rules for forward #first try statistic chains $IPTABLES -A FORWARD -j lstat #for others hosts $IPTABLES -A FORWARD -i $INT_INTERFACE -j ACCEPT $IPTABLES -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT #default DROP packets $IPTABLES -P FORWARD DROP #przkierowanie portow iptables -A PREROUTING -t nat -p tcp --dport 455 -j DNAT --to 192.168.0.9:455 iptables -A PREROUTING -t nat -p tcp --dport 4661 -j DNAT --to 192.168.0.2:4661 iptables -A INPUT -s 0/0 -d 192.168.0.1 -p tcp --dport 22 -j ACCEPT iptables -A FORWARD -s 0/0 -d 192.168.0.1 -p tcp --dport 22 -j ACCEPT iptables -A INPUT -s 0/0 -d 192.168.0.1 -p udp --dport 22 -j ACCEPT iptables -A FORWARD -s 0/0 -d 192.168.0.1 -p udp --dport 22 -j ACCEPT iptables -A INPUT -s 0/0 -d 192.168.0.1 -p tcp --dport 80 -j ACCEPT iptables -A FORWARD -s 0/0 -d 192.168.0.1 -p tcp --dport 80 -j ACCEPT iptables -A INPUT -s 0/0 -d 192.168.0.1 -p udp --dport 80 -j ACCEPT iptables -A FORWARD -s 0/0 -d 192.168.0.1 -p udp --dport 80 -j ACCEPT iptables -A INPUT -s 0/0 -d 192.168.0.1 -p tcp --dport 666 -j ACCEPT iptables -A FORWARD -s 0/0 -d 192.168.0.1 -p tcp --dport 666 -j ACCEPT iptables -A INPUT -s 0/0 -d 192.168.0.1 -p udp --dport 666 -j ACCEPT iptables -A FORWARD -s 0/0 -d 192.168.0.1 -p udp --dport 666 -j ACCEPT iptables -A INPUT -s 0/0 -d 192.168.0.1 -p tcp --dport 53 -j ACCEPT iptables -A FORWARD -s 0/0 -d 192.168.0.1 -p tcp --dport 53 -j ACCEPT iptables -A INPUT -s 0/0 -d 192.168.0.1 -p udp --dport 53 -j ACCEPT iptables -A FORWARD -s 0/0 -d 192.168.0.1 -p udp --dport 53 -j ACCEPT iptables -A INPUT -s 0/0 -d 192.168.0.1 -p tcp --dport 10000 -j ACCEPT iptables -A FORWARD -s 0/0 -d 192.168.0.1 -p tcp --dport 10000 -j ACCEPT iptables -A INPUT -s 0/0 -d 192.168.0.1 -p udp --dport 10000 -j ACCEPT iptables -A FORWARD -s 0/0 -d 192.168.0.1 -p udp --dport 10000 -j ACCEPT iptables -A INPUT -s 0/0 -d 192.168.0.1 -p tcp --dport 8092 -j ACCEPT iptables -A FORWARD -s 0/0 -d 192.168.0.1 -p tcp --dport 8092 -j ACCEPT iptables -A INPUT -s 0/0 -d 192.168.0.1 -p udp --dport 8092 -j ACCEPT iptables -A FORWARD -s 0/0 -d 192.168.0.1 -p udp --dport 8092 -j ACCEPT iptables -A INPUT -s 0/0 -d 83.13.47.42 -p tcp --dport 22 -j ACCEPT iptables -A FORWARD -s 0/0 -d 83.13.47.42 -p tcp --dport 22 -j ACCEPT iptables -A INPUT -s 0/0 -d 83.13.47.42 -p udp --dport 22 -j ACCEPT iptables -A FORWARD -s 0/0 -d 83.13.47.42 -p udp --dport 22 -j ACCEPT iptables -A INPUT -s 0/0 -d 83.13.47.42 -p tcp --dport 80 -j ACCEPT iptables -A FORWARD -s 0/0 -d 83.13.47.42 -p tcp --dport 80 -j ACCEPT iptables -A INPUT -s 0/0 -d 83.13.47.42 -p udp --dport 80 -j ACCEPT iptables -A FORWARD -s 0/0 -d 83.13.47.42 -p udp --dport 80 -j ACCEPT iptables -A INPUT -s 0/0 -d 83.13.47.42 -p tcp --dport 10000 -j ACCEPT iptables -A FORWARD -s 0/0 -d 83.13.47.42 -p tcp --dport 10000 -j ACCEPT iptables -A INPUT -s 0/0 -d 83.13.47.42 -p udp --dport 10000 -j ACCEPT iptables -A FORWARD -s 0/0 -d 83.13.49.42 -p udp --dport 10000 -j ACCEPT iptables -A INPUT -s 0/0 -d 192.168.0.9 -p tcp --dport 455 -j ACCEPT iptables -A FORWARD -s 0/0 -d 192.168.0.9 -p tcp --dport 455 -j ACCEPT iptables -A INPUT -s 0/0 -d 192.168.0.9 -p udp --dport 455 -j ACCEPT iptables -A FORWARD -s 0/0 -d 192.168.0.9 -p udp --dport 455 -j ACCEPT iptables -A INPUT -s 0/0 -d 192.168.0.2 -p tcp --dport 4661 -j ACCEPT iptables -A FORWARD -s 0/0 -d 192.168.0.2 -p tcp --dport 4661 -j ACCEPT iptables -A INPUT -s 0/0 -d 192.168.0.2 -p udp --dport 4661 -j ACCEPT iptables -A FORWARD -s 0/0 -d 192.168.0.2 -p udp --dport 4661 -j ACCEPT # Tobi iptables -t nat -A POSTROUTING -s 192.168.0.2 -j MASQUERADE iptables -A FORWARD -m mac --mac-source 12:34:56:78:91:23 -j ACCEPT # Mateusz iptables -t nat -A POSTROUTING -s 192.168.0.3 -j MASQUERADE iptables -A FORWARD -m mac --mac-source 00:E0:7D:84:24:EE -j ACCEPT # Mateusz iptables -t nat -A POSTROUTING -s 192.168.0.3 -j MASQUERADE iptables -A FORWARD -m mac --mac-source 00:04:61:77:37:1B -j ACCEPT # Grzesiek iptables -t nat -A POSTROUTING -s 192.168.0.4 -j MASQUERADE iptables -A FORWARD -m mac --mac-source 00:30:4F:15:55:FF -j ACCEPT # Olka - 1 iptables -t nat -A POSTROUTING -s 192.168.0.6 -j MASQUERADE iptables -A FORWARD -m mac --mac-source 00:08:02:F2:98:58 -j ACCEPT # Olka - 2 iptables -t nat -A POSTROUTING -s 192.168.0.6 -j MASQUERADE iptables -A FORWARD -m mac --mac-source 00:02:3F:B0:5E:4E -j ACCEPT # IWP iptables -t nat -A POSTROUTING -s 192.168.0.8 -j MASQUERADE iptables -A FORWARD -m mac --mac-source 00:30:4F:15:C8:60 -j ACCEPT # Dominik iptables -t nat -A POSTROUTING -s 192.168.0.9 -j MASQUERADE iptables -A FORWARD -m mac --mac-source 00:0B:6A:66:11:8D -j ACCEPT # Kama iptables -t nat -A POSTROUTING -s 192.168.0.16 -j MASQUERADE iptables -A FORWARD -m mac --mac-source 00:E0:4C:BF:72:3E -j ACCEPT # Wiesia iptables -t nat -A POSTROUTING -s 192.168.0.18 -j MASQUERADE iptables -A FORWARD -m mac --mac-source 00:D0:B7:28:5C:B9 -j ACCEPT # starzy iptables -t nat -A POSTROUTING -s 192.168.0.22 -j MASQUERADE iptables -A FORWARD -m mac --mac-source 00:90:CC:82:54:4E -j ACCEPT # Urbanowicz iptables -t nat -A POSTROUTING -s 192.168.0.40 -j MASQUERADE iptables -A FORWARD -m mac --mac-source 00:40:F4:97:5A:74 -j ACCEPT # Anka iptables -t nat -A POSTROUTING -s 192.168.0.50 -j MASQUERADE iptables -A FORWARD -m mac --mac-source 00:C0:9F:DC:E9:1E -j ACCEPT # - iptables -t nat -A POSTROUTING -s -j MASQUERADE iptables -A FORWARD -m mac --mac-source -j ACCEPT iptables -D FORWARD -m mac --mac-source 00:D0:B7:28:5C:B9 -j ACCEPT iptables -A FORWARD -m mac --mac-source 00:D0:B7:28:5C:B9 -p udp --dport 53 -j A iptables -A FORWARD -m mac --mac-source 00:D0:B7:28:5C:B9 -p tcp --dport 666 -s iptables -A PREROUTING -t nat -s 192.168.0.18 -p tcp --dport 1:52 -j DNAT --to 1 iptables -A PREROUTING -t nat -s 192.168.0.18 -p tcp --dport 54:65535 -j DNAT --
teraz ustawienia etc/network/interfaces
# This file describes the network interfaces available on your system # and how to act.ivate them. For more information, see interfaces(5). # The loopback network interface auto lo iface lo inet loopback # The primary network interface auto eth1 iface eth1 inet static address 83.13.47.42 eth1:0 83.13.47.43 eht1:1 83.13.47.44 netmask 255.255.255.248 gateway 83.13.47.41 # dns-* options are implemented by the resolvconf package, if installed dns-nameservers 194.204.159.1 194.204.152.34 auto eth0 iface eth0 inet static address 192.168.0.1 netmask 255.255.255.0
prosze o wyrozumialosc debiana mam od tygodnia
zewn ip dalej nie dziala :(
zobacz przez
ip addr show dev eth1
[/quote]
bash: ip: command not found :(
Offline
w jakiej kolejnosci sa odpalane reguly ?? dla pewnosci usun z firewala:
iptables -t nat -A POSTROUTING -s 192.168.0.2 -j MASQUERADE
[/quote]
poniewaz:
a) nie jest ci to potrzebne jak snatujesz pakiet,
b) jezeli masquarada jest odpalana jako pierwsza to regoly snat sa "pomijane" dla 192.168.0.2
a pozostale -j MASQUARADE zamien na -j SNAT $EXT_IP ( co jest szybsze przy stalym zewnetrznym ip ).
zapodaj tezKod:
apt-get install iproutei potem odpal
Kod:
ip addr show dev eth1
Nie ma nie idzie... jest nie umiem.
Offline
w jakiej kolejnosci sa odpalane reguly ?? dla pewnosci usun z firewala:
mmm nie bardzo wiem jak to sprawdzic w firewallu SNAT jest przed maskarada
jak wytne masquerde dla mojego kompa to net wogole nie dziala ponadto wyskakuje taki blad:
Bad argument `PREROUTING'
Try `iptables -h' or 'iptables --help' for more information.
Bad argument `POSTROUTING'
Try `iptables -h' or 'iptables --help' for more information.
a pozostale -j MASQUARADE zamien na -j SNAT $EXT_IP ( co jest szybsze przy stalym zewnetrznym ip ).
wyskakuje:
Try `iptables -h' or 'iptables --help' for more information.
iptables v1.2.11: You must specify --to-source
Try `iptables -h' or 'iptables --help' for more information.
do tego snatowania nie trzeba nic zainstalowac ??
wlaczylem jeszcze
ip_forward na yes nie weim czy to moze cos pomoze
ip addr show dev eth1 3: eth1: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast qlen 1000 link/ether 00:80:ad:97:7a:57 brd ff:ff:ff:ff:ff:ff inet 83.13.47.42/29 brd 83.255.255.255 scope global eth1 inet 83.13.47.43/29 brd 83.13.47.49 scope global secondary eth1
a moze jest jakies znaczenie ze swiat mam eth1 a nie 0 ?? i chyba cos tutaj z broadcastem jest napieszane czy tak ma zostac ?
wywalilem jeszcze z firewalla regulki do lstata bo mieszaly w ustawieniach firewalla
wogole to sie zastanawiam czy moze dodac aliasy przez webmina ?
Offline
nie bardzo widzie zwiazek miedzy wyrzucieniem lini:
iptables -t nat -A POSTROUTING -s 192.168.0.2 -j MASQUERADE
a bledem:
Bad argument `PREROUTING'
Try `iptables -h' or 'iptables --help' for more information.
Bad argument `POSTROUTING'
Try `iptables -h' or 'iptables --help' for more information[/quote]
zobacz czy czasem czegos za duzo nie usunales.
majac dzialajacy snat, maskarada ci nie jest potrzebna (oczywiscie dla snatowanego ip lokalnego) i net powinien chodzic ( snat i maskarada dzialaja prawie tak samo).
a pozostale -j MASQUARADE zamien na -j SNAT $EXT_IP[/quote]
ty byla tylko informacja co masz na co zamienic a nie kompletna regula. jezeli bys sie przyjrzal swojemu firewalowi to tam jest napisane jak wyglada SNAT czyli -j SNAT -to-source $EXT_IP
nic nie musisz wiecej instalowac, man iptables
nie ma znaczenia czy na swiat masz eth1 czy 0. co do brodcastu to jest on niepoprawny dla adresu 83.13.47.42 powinienes ustawic tak jak ci podalem dla 83.13.47.43.
Nie ma nie idzie... jest nie umiem.Offline
dobra zewn ip zrobilem
a gdzie byl problem ?? :) aliasy
jak dodalem przez webmina to ruszylo
-j SNAT -to-source $EXT_IP
najpierw sie czepia ze -to-source zamieniam na --to-source ale i tak ma jakies problemy z tym powiedzmy ze zostawie tak jak jest :)
ale teraz kolejny problem oczywiscie swojego kompa mam skonfigurowanego (ip) wpisuje jako 192.168.0.2 a nie zewn no i problem jest taki ze myslalem ze omijany bedzie firewall serwera a uzywany bedzie tylko moj :| niestety tak nie jest i teraz nie wiem jak to ustawic azeby otworzyc wszystkie porty na mojego kompa w lanie (blokowanie portow na firewallu na kompie a nie na serwerze)
Offline
Time (s) | Query |
---|---|
0.00009 | SET CHARSET latin2 |
0.00004 | SET NAMES latin2 |
0.00119 | SELECT u.*, g.*, o.logged FROM punbb_users AS u INNER JOIN punbb_groups AS g ON u.group_id=g.g_id LEFT JOIN punbb_online AS o ON o.ident='18.118.142.122' WHERE u.id=1 |
0.00106 | REPLACE INTO punbb_online (user_id, ident, logged) VALUES(1, '18.118.142.122', 1738404112) |
0.00053 | SELECT * FROM punbb_online WHERE logged<1738403812 |
0.00072 | SELECT topic_id FROM punbb_posts WHERE id=30617 |
0.00007 | SELECT id FROM punbb_posts WHERE topic_id=3884 ORDER BY posted |
0.00079 | SELECT t.subject, t.closed, t.num_replies, t.sticky, f.id AS forum_id, f.forum_name, f.moderators, fp.post_replies, 0 FROM punbb_topics AS t INNER JOIN punbb_forums AS f ON f.id=t.forum_id LEFT JOIN punbb_forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id=3) WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.id=3884 AND t.moved_to IS NULL |
0.00006 | SELECT search_for, replace_with FROM punbb_censoring |
0.00211 | SELECT u.email, u.title, u.url, u.location, u.use_avatar, u.signature, u.email_setting, u.num_posts, u.registered, u.admin_note, p.id, p.poster AS username, p.poster_id, p.poster_ip, p.poster_email, p.message, p.hide_smilies, p.posted, p.edited, p.edited_by, g.g_id, g.g_user_title, o.user_id AS is_online FROM punbb_posts AS p INNER JOIN punbb_users AS u ON u.id=p.poster_id INNER JOIN punbb_groups AS g ON g.g_id=u.group_id LEFT JOIN punbb_online AS o ON (o.user_id=u.id AND o.user_id!=1 AND o.idle=0) WHERE p.topic_id=3884 ORDER BY p.id LIMIT 0,25 |
0.00135 | UPDATE punbb_topics SET num_views=num_views+1 WHERE id=3884 |
Total query time: 0.00801 s |