Answer the question
In order to leave comments, you need to log in
How to give access to the Internet from a different subnet?
Firework!
There is a task: to give access to certain resources through a remote server (so that they go to Yandex as usual, and to Google through a server in Belgium), plus connect the remote server to the local office.
We have a server in the data center, on which several VMs are deployed. The server has a physical interface with Internet access (masquerade) and a local virtual bridge virbr1 (172.16.18.1/24) to which VM interfaces are added (libvirt standard practice)
SoftEther VPN is installed on the server.
It has two hubs (local for connecting from the office, and vpn for connecting users)
A tap bridge has been created for the local hub, added to virbr1. When a user connects to this hub, sets himself an IP from 172,16,18,0/24, then he gets access to the virtual local area through virbr1, and if you write
route add -host 213.180.193.3 gw 172.16.18.1 (ip yandex.ru)
>routeriflist router
IP Address |Subnet Mask |Virtual Hub Name
-----------+-------------+----------------
172.16.18.3|255.255.255.0|local
172.16.20.1|255.255.254.0|vpn
>routertablelist router
Network Address|Subnet Mask |Gateway Address|Metric
---------------+-------------+---------------+------
0.0.0.0 |0.0.0.0 |172.16.18.1 | 10
172.16.20.0 |255.255.254.0|172.16.20.1 | 10
# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 x.x.x.x 0.0.0.0 UG 100 0 0 enp1s0f0
y.y.y.y 0.0.0.0 255.255.255.248 U 100 0 0 enp1s0f0
172.16.18.0 0.0.0.0 255.255.255.0 U 0 0 0 virbr1
172.16.20.0 172.16.18.3 255.255.254.0 UG 0 0 0 virbr1
route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 172.16.4.1 0.0.0.0 UG 202 0 0 enp2s0
213.180.193.3 172.16.20.1 255.255.255.255 UGH 203 0 0 vpn_vpn0
172.16.4.0 0.0.0.0 255.255.255.0 U 202 0 0 enp2s0
172.16.18.0 172.16.20.1 255.255.255.0 UG 203 0 0 vpn_vpn0
172.16.20.0 0.0.0.0 255.255.254.0 U 203 0 0 vpn_vpn0
Answer the question
In order to leave comments, you need to log in
The problem turned out to be FirewallD. In view of the specifics of its work (or my curvature), access to the external interface was allowed only from the network 172.16.18.0/24, as evidenced by the rule
-A FORWARD -d 172.16.18.0/24 -i eth0 -o eth1 -j ACCEPT
-A FORWARD -s 172.16.18.0/24 -i eth1 -o eth0 -j ACCEPT
ipv4 filter FORWARD 0 -i eth0 -o eth1 -d 172.16.4.0/24 -j ACCEPT
ipv4 filter FORWARD 0 -i eth1 -o eth0 -s 172.16.4.0/24 -j ACCEPT
iptables -I FORWARD 1 -d 172.16.4.0/24 -i eth0 -o eth1 -j ACCEPT
iptables -I FORWARD 1 -s 172.16.4.0/24 -o eth0 -i eth1 -j ACCEPT
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question