NAT ?? Debian Jessie

????? 2 ??????? ??????????:
eth0 — ????????? ???? 192.168.40.1
eth1 — ???????? 100.200.1.1

????????? ???????????
vim /etc/apt/sources.list:

deb http://ftp.ua.debian.org/debian/ jessie main

aptitude update
aptitude -y install isc-dhcp-server iptables-persistent

??????????? ??????? ??????????
vim /etc/network/interfaces:

auto eth1
allow-hotplug eth1
iface eth1 inet dhcp

auto eth0
allow-hotplug eth0
iface eth0 inet static
    address 192.168.40.1

invoke-rc.d networking stop && invoke-rc.d networking start

???????? ????????? ??????? ? ????:
vim /etc/sysctl.conf:

net.ipv4.ip_forward=1

sysctl -p

vim /etc/dhcp/dhcpd.conf:

ddns-update-style none;
option domain-name-servers ????? ????? ??????? ????????? IP ?????? ?????? ???????? ??????????;
default-lease-time 600;
max-lease-time 7200;
authoritative;
log-facility local7;
subnet 192.168.40.0 netmask 255.255.255.0 {
range 192.168.40.2 192.168.40.10;
option routers 192.168.40.1;
}

???????? ?????????, ?? ??????? ????? ???????? DHCP ??????
vim /etc/default/isc-dhcp-server:

INTERFACES="eth0"

invoke-rc.d isc-dhcp-server start

???????? NAT ? ????????? ???? ??? DHCP ????????
iptables -I POSTROUTING 1 -s 192.168.40.0/24 -o eth1 -j SNAT --to-source 100.200.1.1
iptbales -I INPUT 2 -s 192.168.40.0/24 -d 192.168.40.1 -i eth0 -p udp --dport 67 -j ACCEPT
invoke-rc.d netfilter-persistent save

Добавить комментарий

Ваш e-mail не будет опубликован. Обязательные поля помечены *