]>
git.ipfire.org Git - ipfire-2.x.git/blob - src/initscripts/system/swconfig
2 ########################################################################
3 # Begin $rc_base/init.d/swconfig
5 # Description : Script to setup lan switch.
6 # don't edit this script! If you want change the functions
7 # create an own script called swconfig.user
8 ########################################################################
13 if [ -e /etc
/init.d
/swconfig.user
]; then
14 /etc
/init.d
/swconfig.user $
*
18 if [ -e /var
/ipfire
/ethernet
/swconfig_mac
]; then
19 SWMAC
=`cat /var/ipfire/ethernet/swconfig_mac`
21 # Generate a random local administrated mac address for vlan swconfig.
22 SWMAC
=`printf "%1x2:%02x:%02x:%02x:%02x" $[RANDOM%16] $[RANDOM%256] $[RANDOM%256] $[RANDOM%256] $[RANDOM%256]`
23 echo $SWMAC > /var
/ipfire
/ethernet
/swconfig_mac
28 case `cat /proc/device-tree/model 2>/dev/null` in
31 # Lamobo R1 aka BPi R1 Routerboard
33 # Speaker | LAN4 | LAN3 | LAN2 | LAN1 || WAN | HDMI
34 # SW-Port | P2 | P1 | P0 | P4 || P3 |
35 # MAC-Add | 14 | 13 | 12 | 11 || 10 |
37 # Switch-Port P8 - internal CPU Port
42 device
=`ls /sys/class/net/*/device/driver/1c50000.ethernet/net | head -1`
43 ip link
set $device up
45 # set local mac addresses.
46 ip link
set dev wan address
$SWMAC:10
47 ip link
set dev lan1 address
$SWMAC:11
48 ip link
set dev lan2 address
$SWMAC:12
49 ip link
set dev lan3 address
$SWMAC:13
50 ip link
set dev lan4 address
$SWMAC:14
54 /etc
/init.d
/udev start
61 echo "Usage: ${0} {start}"
66 # End $rc_base/init.d/swconfig