复制到python中,实际测试正常使用。
radius_ip = input(print('radius服务器IP地址:'))
authen_port = input(print('radius服务器认证端口:'))
account_port = input(print('radius服务器计费端口:'))
radius_password = input(print('radius服务器秘钥:'))
authorize_vlan = input(print('逃生VLAN:'))
print('radius-server template feilian_rd')
print('radius-server authentication',radius_ip,authen_port)
print('radius-server accounting',radius_ip,account_port)
print('radius-server shared-Key cipher',radius_password)
print('''
#配置 aaa 认证方案和计费方案
aaa
authentication-scheme feilian_aaa
authentication-mode radius
quit
accounting-scheme feilian_aaa
accounting-mode radius
accounting realtime 5
quit
#配置认证域
domain feilian_ad
authentication-scheme feilian_aaa
accounting-scheme feilian_aaa
radius-server feilian_rd
quit
quit
''')
#配置 dot1x 认证模板
print('dot1x-access-profile name feilian_ap')
print('dot1x authentication-method eap')
print('authentication event client-no-response action authorize vlan',authorize_vlan)
print('quit')
print('''
# 配置 mac 认证模版
mac-access-profile name mac_ap
mac-authen username macaddress format with-hyphen normal
quit
#配置dot1x认证超时时间30秒,进行mac地址认证
dot1x timer mac-bypass-delay 30
#配置认证模版 authentication-profile
authentication-profile name feilian_apf
dot1x-access-profile feilian_ap
access-domain feilian_ad force
''')
print('authentication event authen-server-down action authorize vlan',authorize_vlan)
print('''
mac-access-profile mac_ap
authentication dot1x-mac-bypass
quit
# 配置Coa
''')
print('radius-server authorization',radius_ip,'shared-key cipher',radius_password,'server-group feilian_rd')
print('radius-server session-manage',radius_ip,'shared-key cipher',radius_password)