Changes
Jump to navigation
Jump to search
← Older edit
Newer edit →
Debian as router
(edit)
Revision as of 11:59, 30 October 2018
704 bytes added
,
11:59, 30 October 2018
→Make a debian box router
Line 27:
Line 27:
=== Add route to linux ===
=== Add route to linux ===
ip route add 10.0.192.0/18 via 15.17.160.217 dev eth0
ip route add 10.0.192.0/18 via 15.17.160.217 dev eth0
+
+
+
+
= With SystemD ==
+
== Enable Nat Script ==
+
<source lang="bash">#!/bin/bash
+
Ariel=15.17.170.200
+
Arrow=15.17.169.59
+
Carabanchel=15.17.170.206
+
Marito=15.17.160.181
+
CarlosDuque=15.17.170.138
+
Mapper=15.17.163.102
+
+
sudo sysctl -w net.ipv4.ip_forward=1
+
+
function clear_nat {
+
for i in $( sudo iptables -t nat -L -n -v --line-numbers | grep ^[0-9] | awk '{ print $1 }' )
+
do sudo iptables -t nat -D POSTROUTING 1
+
done
+
}
+
+
function add_nat {
+
sudo iptables -t nat -A POSTROUTING -s ${1}/32 -o tun0 -j MASQUERADE
+
}
+
+
clear_nat
+
add_nat ${Ariel}
+
add_nat ${Carabanchel}
+
add_nat ${Arrow}
+
add_nat ${CarlosDuque}
+
add_nat ${Marito}
+
add_nat ${Mapper}
+
sudo iptables -t nat --line-numbers -L -n -v<source>
Rafahsolis
Bureaucrats
,
Administrators
2,306
edits
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Page
Discussion
Variants
Views
Read
Edit
View history
More
Search
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Tools
Special pages
Printable version