Do tej pory mialem jedna siec eth0 i jedno ip zewnetrzne przez ktore ona wychodzila.
Jednak postanowilem podzielic ja na dwie i nowoutworzona wypuscic przed drugie ip zewnetrzne.
Posiadam dsl od tpsa
Czyli aktualnie mam:
- eth0 -IPnr1 zewnetrzne
eth3 -IPnr2 zewnetrzne
eth1 - siecnr1 z brama x.x.x.3
Kod: Zaznacz cały
eth1:1 - siecnr2 z brama y.y.y.4
w iptables dodalem regulki:
Kod: Zaznacz cały
iptables -t nat -A POSTROUTING -s siecnr1 -j SNAT --to IPnr1
Kod: Zaznacz cały
iptables -t nat -A POSTROUTING -s siecnr2 -j SNAT --to IPnr2
route -n pokazuje
Kod: Zaznacz cały
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
A 0.0.0.0 255.255.255.248 U 0 0 0 eth0
A 0.0.0.0 255.255.255.248 U 0 0 0 eth3
siecnr2 0.0.0.0 255.255.255.0 U 0 0 0 eth1
siecnr1 0.0.0.0 255.255.255.0 U 0 0 0 eth1
0.0.0.0 B 0.0.0.0 UG 0 0 0 eth3
0.0.0.0 B 0.0.0.0 UG 0 0 0 eth0
B - IP brama DSL
ip route show pokazuje
Kod: Zaznacz cały
A/29 dev eth0 proto kernel scope link src IPnr1
A/29 dev eth3 proto kernel scope link src IPnr2
siecnr2/24 dev eth1 proto kernel scope link src y.y.y.4
siecnr1/24 dev eth1 proto kernel scope link src x.x.x.3
default via A dev eth3
default via A dev eth0