MKTUN Module Overview
MKTUN Overview
MKTUN is a module used to manage tunnel configurations on AIX systems. It allows for the creation, activation, deactivation, and removal of tunnels. The module can also export and import tunnel definitions, supporting both IPv4
IPv6
7.1
TL3
3.6
Commands Used in MKTUN
The module uses various commands to perform its operations:
: Creates tunnel definitions.gentun
: Lists tunnel definitions from the tunnel database.lstun
: Manages tunnel configurations.mktun
: Removes tunnel configurations.rmtun
: Exports tunnel definitions.exptun
: Imports tunnel definitions.imptun
Main Functions
There are several main functions in this module, including gentun
lstun
make_devices
main
gentun
lstun
gentun
The gentun
def gentun(module, vopt, tun):
"""
Create the manual tunnel definition in the tunnel database
with gentun and return the tunnel id.
"""
cmd = [gentun_path, vopt, '-t', 'manual', '-s',
tun['src']['address'], '-d', tun['dst']['address']]
# gentun options that use lowercase letters for source and uppercase for destination
gentun_opts = {
'ah_algo': '-a',
'enc_mac_algo': '-b',
'enc_mac_key': '-c',
'esp_algo': '-e',
'ah_key': '-h',
'esp_key': '-k',
'esp_spi': '-n',
'ah_spi': '-u'
}
for key, opt in gentun_opts.items():
if tun['src'][key]:
lstun
The lstun
def lstun(module):
"""
List manual tunnel definitions from tunnel database.
Fields returned by lstun -O for manual tunnels:
tunnel|source|dest|policy|dpolicy|mask|fw|emode|tunlife|
sspia|dspia|aalgo|daalgo|sakey|dakey|
sspie|dspie|ealgo|dealgo|sekey|dekey|
eaalgo|deaalgo|seakey|deakey|
replay|header
"""
tunnels = {}
for version in ['ipv4', 'ipv6']:
tunnels[version] = {}
vopt = '-v4' if version != 'ipv6' else '-v6'
# List tunnel definitions in tunnel database
cmd = [lstun_path, vopt, '-p', 'manual', '-O']
rc, stdout, stderr = module.run_command(cmd)
Example Usage of MKTUN
This example demonstrates how to create and activate a manual IPv4
Example of creating and activating a manual IPv4
- name: Create and activate a manual IPv4 tunnel
mktun:
manual:
ipv4:
- src:
address: 10.10.11.72
ah_algo: HMAC_MD5
esp_algo: DES_CBC_8
dst:
address: 10.10.11.98
esp_spi: 12345
This is an auto-generated document by Swimm 🌊 and has not yet been verified by a human