fix nat module flush
This commit is contained in:
parent
07f5ddd153
commit
0ccbe3922f
1 changed files with 7 additions and 5 deletions
|
@ -280,10 +280,13 @@ def setpubips():
|
||||||
rr = open('/root/pubip.cache', 'r').read()
|
rr = open('/root/pubip.cache', 'r').read()
|
||||||
cache = json.loads(rr)
|
cache = json.loads(rr)
|
||||||
data = ''
|
data = ''
|
||||||
|
data += """
|
||||||
|
$IPT -t nat -P PREROUTING ACCEPT
|
||||||
|
$IPT -t nat -P POSTROUTING ACCEPT
|
||||||
|
$IPT -t nat -F
|
||||||
|
$IPT -t nat -X
|
||||||
|
"""
|
||||||
for ip, vlan in cache.items():
|
for ip, vlan in cache.items():
|
||||||
print('ip: ' + ip)
|
|
||||||
print('vlan: ' + vlan)
|
|
||||||
print(' ')
|
|
||||||
data += """
|
data += """
|
||||||
ip link del vtap{1}
|
ip link del vtap{1}
|
||||||
ip link add vtap{1} link $INET_IFACE type macvlan
|
ip link add vtap{1} link $INET_IFACE type macvlan
|
||||||
|
@ -300,6 +303,5 @@ if __name__ == "__main__":
|
||||||
bashexec('vlfconfig', setvlans(clientiface))
|
bashexec('vlfconfig', setvlans(clientiface))
|
||||||
|
|
||||||
if sys.argv[1] == 'apply':
|
if sys.argv[1] == 'apply':
|
||||||
print(setpubips())
|
bashexec('ipfconfig', setpubips())
|
||||||
#bashexec('ipfconfig', setpubips())
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue