Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Nat в несколько внешних ip
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Russian
View previous topic :: View next topic  
Author Message
antey86
n00b
n00b


Joined: 10 Nov 2009
Posts: 4

PostPosted: Tue Nov 10, 2009 5:24 am    Post subject: Nat в несколько внешних ip Reply with quote

Доброго времени суток!
есть вопрос.
есть комп с 2 nic'ами, за которым роутер с несколькими подсетками (192.168.1-10.0)
eth0 смотрит в инет (на нем неск ИП алиасами - 1.2.3.1-10)
eth1 в локалку (коннект с роутером по ИПу 192.168.0.1-2/30)
как можно организовать НАТ в несколько внешних ИПов с определенных подсети.
напр.
192.168.1.0/24 в 1.2.3.1
192.168.2.0/24 в 1.2.3.2
192.168.3.0/24 в 1.2.3.3
192.168.4.0/24 в 1.2.3.4
192.168.5.0/24 в 1.2.3.5
...
192.168.10.0/24 в 1.2.3.10

интересует, как организовать все это через iptables, и как будут выглядеть маршруты
благодарю за внимание к моему вопросу.
Back to top
View user's profile Send private message
antey86
n00b
n00b


Joined: 10 Nov 2009
Posts: 4

PostPosted: Tue Nov 10, 2009 7:45 am    Post subject: Reply with quote

решено
Back to top
View user's profile Send private message
ArhAngel
n00b
n00b


Joined: 21 Mar 2009
Posts: 6

PostPosted: Wed Nov 11, 2009 3:42 am    Post subject: Reply with quote

antey86 wrote:
решено

а решение проблемы никак....?
Back to top
View user's profile Send private message
antey86
n00b
n00b


Joined: 10 Nov 2009
Posts: 4

PostPosted: Thu Nov 12, 2009 6:12 am    Post subject: Reply with quote

my $n=10;
my $x=1;

for ($i=10; $i>=1; $i--)
{
system "/sbin/ifconfig eth0:$x down";
system "/sbin/ifconfig eth0:$x 1.2.3.$n/32";
system "/sbin/iptables -t nat -D POSTROUTING -s 192.168.$i.0/24 -o eth0 -j SNAT --to-source 1.2.3.$n";
system "/sbin/iptables -t nat -I POSTROUTING 1 -s 192.168.$i.0/24 -o eth0 -j SNAT --to-source 1.2.3.$n";
$n--;
$x++;
}
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Russian All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum