config 2 networkinterfaces

Kernels & Hardware, configuring network, installing services

config 2 networkinterfaces

Postby garfield » 2017-07-07 12:08

Hi,
I'm trying to get 2 networks to work in my virtual machine but I have a few problems:
When I try to connect with SSH over port 22 I can't connect on the 192.168.1.240 but only at the 10.5.49.5.

192.168.1.240 is my IP address with internetconnection, this I need to establish my VPN-connection.
10.5.49.5 is the network without internetconnection I want to access though a VPN connection over the internet using the 192.168.1.240

/etc/network/interfaces:
Code: Select all
source /etc/network/interfaces.d/*

auto lo
iface lo inet loopback

allow-hotplug eth0
iface eth0 inet static
address 192.168.1.240
netmask 255.255.255.0
post-up ip route add 192.168.1.0/24 dev eth0 src 192.168.1.240 table rt2
post-up ip route add default via 192.168.1.1 dev eth0 table rt2
post-up ip rule add from 192.168.1.240/32 table rt2
post-up ip rule add to 192.168.1.240/32 table rt2
metric 1

allow-hotplug eth1
iface eth1 inet static
address 10.5.49.5
netmask 255.255.255.0
post-up ip route add 10.5.49.0/24 dev eth1 src 10.5.49.5 table rt2
post-up ip route add default via 10.5.49.200 dev eth1 table rt2
post-up ip rule add from 10.5.49.5/32 table rt2
post-up ip rule add to 10.5.49.5/32 table rt2
metric 100


route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 eth0
10.8.0.0 10.8.0.2 255.255.255.0 UG 0 0 0 tun0
10.8.0.2 0.0.0.0 255.255.255.255 UH 0 0 0 tun0
10.5.49.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0

ip route show
default via 192.168.1.1 dev eth0
10.8.0.0/24 via 10.8.0.2 dev tun0
10.8.0.2 dev tun0 proto kernel scope link src 10.8.0.1
10.5.49.0/24 dev eth1 proto kernel scope link src 10.5.49.5
192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.240

I thing due to a fault routing I can't connect to the SSH and VPN. It works fine on the 10.5.49.5 so the firewall forwards it succesfully.

ufw status
Status: active

To Action From
-- ------ ----
22 ALLOW Anywhere
80/udp ALLOW Anywhere
22 ALLOW Anywhere (v6)
80/udp ALLOW Anywhere (v6)

My VPN enters through port 80 and not the usual 1194

What am I doing wrong and how can I fix it.
I'm not a real wizard with Debian so please explain easily :D
garfield
 
Posts: 13
Joined: 2013-03-15 21:29

Return to System configuration

Who is online

Users browsing this forum: No registered users and 7 guests

fashionable