ofMyCity forum

Форум => Компьютеры => Тема начата: subwoofer от 01 Декабря, 2008, 15:16:07

Название: linux nat
Отправлено: subwoofer от 01 Декабря, 2008, 15:16:07
Вот попалось на глаза, что нат можно делать  через iproute2:
Это именно NAT, в отличие от PAT, который через iptables
Цитировать
[root@masq-gw]# ip route add nat 205.254.211.17 via 192.168.100.17 
[root@masq-gw]# ip rule add nat 205.254.211.17 from 192.168.100.17 
[root@masq-gw]# ip route flush cache                               
[root@masq-gw]# ip route show table all | grep ^nat                 
nat 205.254.211.17 via 192.168.100.17  table local  scope host
[root@masq-gw]# ip rule show                                       
0:      from all lookup local
32765:  from 192.168.100.17 lookup main map-to 205.254.211.17
32766:  from all lookup main
32767:  from all lookup 253
         
    This command tells the kernel to perform network address translation on any packet bound for 205.254.211.17. The parameter via tells the NAT code to rewrite the packet bound for 205.254.211.17 with the new destination address 192.168.100.17. Note, that this only handles inbound packets; that is, packets whose destination address contains 205.254.211.17.
    This command enters the corresponding rule for the outbound traffic into the RPDB (kernel 2.2 and up). This rule will cause the kernel rewrite any packet from 192.168.100.17 with the specified source address (205.254.211.17). Any packet originating from 192.168.100.17 which passes through this router will trigger this rule. In short, this command rewrites the source address of outbound packets so that they appear to originate from the NAT IP.
    The kernel maintains a routing cache to handle routing decisions more quickly (Section 4.7, “Routing Cache”). After making changes to the routing tables on a system, it is good practice to empty the routing cache with ip route flush cache. Once the cache is empty, the kernel is guaranteed to consult the routing tables again instead of the routing cache.
     These two commands allow the user to inspect the routing policy database and the local routing table to determine if the NAT routes and rules were added correctly.
Название: Re: linux nat
Отправлено: alf от 01 Декабря, 2008, 16:15:33
а почему энто PAT то ?
Название: Re: linux nat
Отправлено: wiggin от 01 Декабря, 2008, 17:00:34
а мана говорит что - Warning: Route NAT is no longer supported in Linux 2.6. :-[
Название: Re: linux nat
Отправлено: subwoofer от 01 Декабря, 2008, 18:01:53
а почему энто PAT то ?
потому што Port Address Translation
а голый нат это када адин на адин транслируется

а мана говорит что - Warning: Route NAT is no longer supported in Linux 2.6.
и то правда, видимо, никто  не пользовался :)
Название: Re: linux nat
Отправлено: alf от 01 Декабря, 2008, 21:02:27
вот я и спрашиваю почему порт то?
ну в ДНАТе порт..а в СНАТе? а в маскараде ?
Название: Re: linux nat
Отправлено: subwoofer от 01 Декабря, 2008, 21:23:07
во всем тобой перечисленном - ПАТ
потому что два рагапила с серыми адресами занатятся в один и тот же квартет адресов-портов
а с ПАТом - каждый следущий получит сорс порт на адин больше, если исходный уже занят - и все будет работать..
кароче, фигня это все, зря я на флейту в первом класе отказался ходить, лабенил бы щас на дудке....
Название: Re: linux nat
Отправлено: alf от 01 Декабря, 2008, 22:16:52
кароче, фигня это все, зря я на флейту в первом класе отказался ходить, лабенил бы щас на дудке..
и толку ? :)
Название: Re: linux nat
Отправлено: wiggin от 02 Декабря, 2008, 05:06:38
одной рукой на гитаре, другой на дудке :) - почти оркестр  ;)