From 9c7dca3423fe1865eac0e3d96c51b3ab48b3ddc4 Mon Sep 17 00:00:00 2001 From: Astro Date: Tue, 6 Dec 2016 03:09:42 +0100 Subject: [PATCH] cpe: attempt TL-WR1043ND --- salt/cpe/ap.sh | 46 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/salt/cpe/ap.sh b/salt/cpe/ap.sh index 67b4325..d245991 100644 --- a/salt/cpe/ap.sh +++ b/salt/cpe/ap.sh @@ -11,7 +11,7 @@ ssh root@{{ pillar['hosts-inet']['mgmt'][hostname] }} \ {%- endif %} # Set root password -echo -e "{{ conf['password'] }}\n{{ conf['password'] }}" | passwd +echo -e '{{ conf['password'] }}\n{{ conf['password'] }}' | passwd # TODO: add ssh pubkey @@ -76,6 +76,50 @@ set network.{{ net }}.proto=static set network.{{ net }}.ifname='eth0.{{ pillar['vlans'][net] }}' {%- endfor %} +{%- elif conf['model'] == 'TL-WR1043ND' %} +{# These models have a shared Ethernet chip with separate CPU ports for LAN/WAN and therefore need switching #} +set network.@switch[0]=switch +set network.@switch[0].reset=1 +set network.@switch[0].enable=1 +set network.@switch[0].enable_vlan=1 +set network.@switch[0].name=switch0 +set network.@switch_vlan[0]=switch_vlan +set network.@switch_vlan[0].device='switch0' +set network.@switch_vlan[0].vlan='1' +set network.@switch_vlan[0].ports='5t 6t' +set network.@switch_vlan[0].comment='mgmt' +{% set switchnum = 1 %} +{%- for net in bridges.keys() %} +set network.@switch_vlan[{{ switchnum }}]=switch_vlan +set network.@switch_vlan[{{ switchnum }}].device='switch0' +set network.@switch_vlan[{{ switchnum }}].vlan='{{ pillar['vlans'][net] }}' +# 0: eth1; 1-4: LAN ports; 5: WAN port; 6: eth0 +{%- if conf.get('lan-access') == net %} +set network.@switch_vlan[{{ switchnum }}].ports='0 1 2 3 4 5t' +{%- else %} +set network.@switch_vlan[{{ switchnum }}].ports='5t 6t' +{%- endif %} +set network.@switch_vlan[{{ switchnum }}].comment='{{ net }}' +{% set switchnum = switchnum + 1 %} +{%- endfor %} + +set network.mgmt=interface +set network.mgmt.ifname=eth0.1 +set network.mgmt.proto=static +set network.mgmt.ipaddr={{ pillar['hosts-inet']['mgmt'][hostname] }} +set network.mgmt.netmask=255.255.255.0 + +{%- for net in bridges.keys() %} +set network.{{ net }}=interface +set network.{{ net }}.type=bridge +set network.{{ net }}.proto=static +{%- if conf.get('lan-access') == net %} +set network.{{ net }}.ifname='eth1' +{%- else %} +set network.{{ net }}.ifname='eth0.{{ pillar['vlans'][net] }}' +{%- endif %} +{%- endfor %} + {%- else %} {# All other models may have separate Ethernet chips for LAN/WAN #} set network.@switch[0].reset=1