T
T
Thiago Alvarez2018-12-21 20:30:20
ubuntu
Thiago Alvarez, 2018-12-21 20:30:20

How to give the Internet to the lok. network. ubuntu server?

Hello. I am a noob admin. Already asked about the same question, but did not understand anything. Decided to tweak it a bit.
In general, there is a network in hyper-v.
ubuntu server that has internet through router.
And 2 users on Windows who do not have the Internet ...
Actually the question is how to give them the Internet?
that is, so that the network 172.10.1.0/24 has Internet!

What do we have to do?
Maybe you need to connect somehow differently ?!
This is what my virtual network looks like:
5c1d1fd8ed53d399873232.jpeg
5c1d2085be071895786357.jpeg
5c1d20dac7d4a660842169.jpeg
> /etc/network/interfaces

iface eth0 inet static
address 172.10.1.10
netmask 255.255.255.0
dns-nameservers 8.8.8.8
auto eth0

iface eth1 inet dhcp
auto eth1

>ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.10.1.10  netmask 255.255.255.0  broadcast 172.10.1.255
        inet6 fe80::215:5dff:feeb:e320  prefixlen 64  scopeid 0x20<link>
        ether 00:15:5d:eb:e3:20  txqueuelen 1000  (Ethernet)
        RX packets 3966  bytes 442595 (442.5 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 2255  bytes 1943409 (1.9 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.103  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::215:5dff:feeb:e321  prefixlen 64  scopeid 0x20<link>
        ether 00:15:5d:eb:e3:21  txqueuelen 1000  (Ethernet)
        RX packets 6236  bytes 2086681 (2.0 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 5665  bytes 782002 (782.0 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Softer, 2018-12-21
@thiago_alvarez

sudo iptables --flush
sudo iptables --table nat --flush
sudo iptables --delete-chain
sudo iptables --table nat --delete-chain

sudo iptables -A FORWARD -i eth0 -o eth1 -s 172.10.1.0/24 -m conntrack --ctstate NEW -j ACCEPT
sudo iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
sudo iptables -A POSTROUTING -t nat -j MASQUERADE

sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"

PS: 172.16.0.0/12. Ваша сеть не входит в этот диапазон. Не надо так.

АртемЪ, 2018-12-22
@Jump

Как дать интернет в лок. сеть. Ubuntu server?
Элементарно.
Отключаем провод от роутера от Ubuntu, и втыкаем его в свитч.
Остальное оставляем как есть.
то есть, чтобы у сети 172.10.1.0/24 был интернет!
Интернет это глобальная сеть. Она везде и никакого отношения к 172.10.1.0/24 не имеет.
Если вы хотите себе локальную сеть с данным диапазоном - укажите его на роутере, когда DHCP будете настраивать.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question