특별한 Interface으로 인터넷 사용하기?

jic5760의 이미지

eth0 : 192.168.0.100/24 gateway:192.168.0.1 (Default Gateway)
tun0 : 10.0.0.100/24 (gateway:10.0.0.1? 10.0.0.101?)
 
 
tun0 Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
     inet addr:10.130.0.10  P-t-P:10.130.0.11  Mask:255.255.255.255
     UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
 
 
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
10.0.0.101      *               255.255.255.255 UH    0      0        0 tun0
10.0.0.1        10.130.0.101    255.255.255.255 UGH   0      0        0 tun0
default         192.168.0.1     0.0.0.0         UG    0      0        0 eth0

이런 구성이 있을때

wget --bind-address=10.0.0.100 -O - http://www.showmyip.gr
오류내용 :

http://www.showmyip.gr/
Resolving <a href="http://www.showmyip.gr" rel="nofollow">www.showmyip.gr</a>... 72.29.71.155
Connecting to <a href="http://www.showmyip.gr" rel="nofollow">www.showmyip.gr</a>|72.29.71.155|:80... failed: 연결 시간 초과.
Retrying.

이렇게 하면 안되던데 어떻게 해야 이런식으로 되게 할 수 있을까요???
tun0 인터페이스를 이용해서 인터넷 통신을 하고 싶습니다.
기본 게이트웨이인 192.168.0.1을 거치지 않구요.
netstat에서 확인해보면 SYN_SENT상태입니다...
또 10.0.0.1 인 게이트웨이에서 ifconfig으로 확인해보면 아에 패킷이 도착하지도 않는거 같습니다.
어떻게 이런식으로 할 수 있을까요?

jic5760의 이미지

VPN Interface을 tap0이라고 하고
tap0 : 10.0.0.100/24 (gateway:10.0.0.1)
이라고 할 때

echo "1      vpnrt" >> /etc/iproute2/rt_tables
 
ip route add 10.0.0.0/24 dev tap0 src 10.0.0.100 table vpnrt
ip route add default via 10.0.0.1 table vpnrt
ip route add 10.0.0.0/24 dev tap0 src 10.0.0.100 
ip rule add from 10.0.0.100 table vpnrt

서버에서는

iptables -t nat -A POSTROUTING -s 10.0.0.0/24 -o 외부인터페이스(eth0) -j SNAT --to-source 외부IP

이렇게 하니까 되네요~!ㅎㅎ