Sunday, January 31, 2016

Access 2 Internet connection Simultaneously using vrf + socks server

-- vrf (Virtual routing and forwarding) is a technology that allows multiple instances of a routing table to co-exist within the same router at the same time. Because the routing instances are independent, the same or overlapping IP addresses can be used without conflicting with each other.

*** information ***

- gateway1 : 192.168.42.129
- gateway2 : 192.168.57.2
- socks server: 192.168.32.1

so it mean your pc has 2 interfaces for Internet links and 1 interface for connecting to socks server

1- route the network 192.168.32.0/24, 192.168.57.0/24 to new virtual route table named 22016 with the following commands

$ sudo ip route add 192.168.57.0/24 dev vboxnet1 table 22016
$ sudo ip route add 192.168.32.0/24 dev vboxnet2 table 22016

$ sudo ip route add default via 192.168.57.1 table 22016

2- socks server configuration
follow one of the following links
http://theamdara.blogspot.com/2016/01/configure-socks-on-mikrotik-router.html
or
http://theamdara.blogspot.com/2014/12/create-socks-server-for-bypass-firewall.html


3- use tsocks for transparent socks wrapper
$ sudo apt-get install tsocks
edit file /etc/tsocks.conf to change server socks ip address, version and port as below
server = 192.168.32.1
server_type = 4
server_port = 1080


4- show routing table
$ ip route show default
default via 192.168.42.129 dev usb0
10.0.3.0/24 dev lxcbr0  proto kernel  scope link  src 10.0.3.1
169.254.0.0/16 dev eth0  scope link  metric 1000
172.16.28.0/24 dev vmnet5  proto kernel  scope link  src 172.16.28.1
172.16.109.0/24 dev vmnet6  proto kernel  scope link  src 172.16.109.1
172.16.130.0/24 dev vmnet10  proto kernel  scope link  src 172.16.130.1
172.16.146.0/24 dev vmnet4  proto kernel  scope link  src 172.16.146.1
172.16.154.0/24 dev vmnet2  proto kernel  scope link  src 172.16.154.1
172.16.168.0/24 dev vmnet7  proto kernel  scope link  src 172.16.168.1
192.168.0.0/24 dev eth0  proto kernel  scope link  src 192.168.0.208
192.168.12.0/24 dev eth0  proto kernel  scope link  src 192.168.12.10
192.168.25.0/24 dev vmnet9  proto kernel  scope link  src 192.168.25.1
192.168.32.0/24 dev vboxnet2  proto kernel  scope link  src 192.168.32.2
192.168.42.0/24 dev usb0  proto kernel  scope link  src 192.168.42.182
192.168.54.0/24 dev vmnet8  proto kernel  scope link  src 192.168.54.1
192.168.56.0/24 dev vboxnet0  proto kernel  scope link  src 192.168.56.1
192.168.57.0/24 dev vboxnet1  proto kernel  scope link  src 192.168.57.1
192.168.126.0/24 dev vmnet3  proto kernel  scope link  src 192.168.126.1
192.168.202.0/24 dev vmnet1  proto kernel  scope link  src 192.168.202.1
 

$ ip route show table 22016
default via 192.168.57.2 dev vboxnet1
192.168.32.0/24 dev vboxnet2  scope link
192.168.57.0/24 dev vboxnet1  scope link 



                  

No comments:

Post a Comment