Skip to content

Instantly share code, notes, and snippets.

@korjavin
Created March 1, 2013 03:58
Show Gist options
  • Save korjavin/5062374 to your computer and use it in GitHub Desktop.
Save korjavin/5062374 to your computer and use it in GitHub Desktop.
linux_custom_route
#ip ro list table isp2
default via 10.64.64.64 dev ppp0 src 10.68.56.108
#ip ru
0: from all lookup local
32765: from all fwmark 0x2 lookup isp2
32766: from all lookup main
32767: from all lookup default
#iptables -L -t mangle
Chain PREROUTING (policy ACCEPT)
target prot opt source destination
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
TCPMSS tcp -- anywhere anywhere tcpflags: SYN,RST/SYN tcpmss match 1400:65495 TCPMSS clamp to PMTU
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
MARK tcp -- anywhere anywhere tcp dpt:2212 MARK set 0x2
Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
#tcpdump -n -i ppp0
09:54:54.681759 IP 19.11.20.20.40782 > xx.xx.xx.xx.2212: Flags [S], seq 2277389391, win 14600, options [mss 1460,sackOK,TS val 15361058 ecr 0,nop,wscale 4], length 0
iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
ip rule add fwmark 2 lookup isp2
iptables -t mangle -A OUTPUT -p tcp --dport 2212 -j MARK --set-mark 2
iptables -t mangle -A OUTPUT -d cloud.sipay.ru -j MARK --set-mark 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment