Changes
Jump to navigation
Jump to search
← Older edit
Newer edit →
Debian as router
(edit)
Revision as of 12:02, 30 October 2018
425 bytes added
,
12:02, 30 October 2018
→With SystemD
Line 31:
Line 31:
= With SystemD =
= With SystemD =
−
==
Enable Nat
Script ==
+
==
Start
Script ==
<source lang="bash">#!/bin/bash
<source lang="bash">#!/bin/bash
Ariel=15.17.170.200
Ariel=15.17.170.200
Line 60:
Line 60:
add_nat ${Mapper}
add_nat ${Mapper}
sudo iptables -t nat --line-numbers -L -n -v<source>
sudo iptables -t nat --line-numbers -L -n -v<source>
+
+
== Stop Script ==
+
<source lang="bash">#!/bin/bash
+
sudo sysctl -w net.ipv4.ip_forward=0
+
+
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
+
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