Здесь показаны различия между двумя версиями данной страницы.
Предыдущая версия справа и слева Предыдущая версия Следующая версия | Предыдущая версия | ||
сервис_nat [2014/09/25 16:17] val [FreeBSD (pf)] |
сервис_nat [2019/07/17 11:24] val [Ubuntu (iptables)] |
||
---|---|---|---|
Строка 4: | Строка 4: | ||
===== Трансляция на основе адреса отправителя ===== | ===== Трансляция на основе адреса отправителя ===== | ||
- | ==== Ubuntu (iptables) ==== | + | ==== Debian/Ubuntu (iptables) ==== |
=== Заполнение таблицы nat (eth1 - внешний интерфейс) === | === Заполнение таблицы nat (eth1 - внешний интерфейс) === | ||
<code> | <code> | ||
- | root@gate:~# apt-get install conntrack | + | root@gate:~# apt install conntrack |
root@gate:~# cat nat.sh | root@gate:~# cat nat.sh | ||
Строка 27: | Строка 27: | ||
root@gate:~# iptables -t nat -n -L -v --line-numbers | root@gate:~# iptables -t nat -n -L -v --line-numbers | ||
- | root@gate:~# apt-get install netstat-nat | + | root@gate:~# conntrack -L |
- | + | ||
- | root@gate:~# netstat-nat -n | + | |
</code> | </code> | ||
Строка 53: | Строка 51: | ||
</code> | </code> | ||
+ | ==== CentOS (firewalld) ==== | ||
+ | |||
+ | * [[https://www.mjhall.org/centos-7-firewalld-nat-router.html|CentOS 7 firewalld NAT router]] | ||
==== FreeBSD ==== | ==== FreeBSD ==== | ||
Строка 68: | Строка 69: | ||
pf_enable=yes | pf_enable=yes | ||
</code><code> | </code><code> | ||
- | [gate:~] # /etc/rc.d/pf check | + | [gate:~] # service pf check |
- | [gate:~] # /etc/rc.d/pf start | + | [gate:~] # service pf start |
[gate:~] # pfctl -vs nat | [gate:~] # pfctl -vs nat | ||
Строка 77: | Строка 78: | ||
===== Трансляция портов сервисов ===== | ===== Трансляция портов сервисов ===== | ||
- | ==== Ubuntu (iptables) ==== | + | ==== Debian/Ubuntu (iptables) ==== |
<code> | <code> | ||
Строка 99: | Строка 100: | ||
#iptables -t nat -A PREROUTING -i eth1 --destination 172.16.1.X -p udp --dport 5060 -j DNAT --to-destination 192.168.X.10:5060 | #iptables -t nat -A PREROUTING -i eth1 --destination 172.16.1.X -p udp --dport 5060 -j DNAT --to-destination 192.168.X.10:5060 | ||
+ | #iptables -t nat -A PREROUTING -i eth1 --destination 172.16.1.X -p tcp --dport 5061 -j DNAT --to-destination 192.168.X.10:5061 | ||
#iptables -t nat -A PREROUTING -i eth1 --destination 172.16.1.X -p udp -m multiport --dport 10000:20000 -j DNAT --to-destination 192.168.X.10 | #iptables -t nat -A PREROUTING -i eth1 --destination 172.16.1.X -p udp -m multiport --dport 10000:20000 -j DNAT --to-destination 192.168.X.10 | ||
#iptables -t nat -A PREROUTING -i eth1 --destination 172.16.1.X -p udp --dport 4569 -j DNAT --to-destination 192.168.X.10:4569 | #iptables -t nat -A PREROUTING -i eth1 --destination 172.16.1.X -p udp --dport 4569 -j DNAT --to-destination 192.168.X.10:4569 |