]>
git.ipfire.org Git - people/mfischer/ipfire-2.x.git/blob - src/initscripts/system/swconfig
2 ###############################################################################
4 # IPFire.org - A linux based firewall #
5 # Copyright (C) 2007-2022 IPFire Team <info@ipfire.org> #
7 # This program is free software: you can redistribute it and/or modify #
8 # it under the terms of the GNU General Public License as published by #
9 # the Free Software Foundation, either version 3 of the License, or #
10 # (at your option) any later version. #
12 # This program is distributed in the hope that it will be useful, #
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15 # GNU General Public License for more details. #
17 # You should have received a copy of the GNU General Public License #
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
20 ###############################################################################
25 if [ -e /etc
/init.d
/swconfig.user
]; then
26 /etc
/init.d
/swconfig.user $
*
30 if [ -e /var
/ipfire
/ethernet
/swconfig_mac
]; then
31 SWMAC
=`cat /var/ipfire/ethernet/swconfig_mac`
33 # Generate a random local administrated mac address for vlan swconfig.
34 SWMAC
=`printf "%1x2:%02x:%02x:%02x:%02x" $[RANDOM%16] $[RANDOM%256] $[RANDOM%256] $[RANDOM%256] $[RANDOM%256]`
35 echo $SWMAC > /var
/ipfire
/ethernet
/swconfig_mac
40 case `cat /proc/device-tree/model 2>/dev/null` in
43 # Lamobo R1 aka BPi R1 Routerboard
45 # Speaker | LAN4 | LAN3 | LAN2 | LAN1 || WAN | HDMI
46 # SW-Port | P2 | P1 | P0 | P4 || P3 |
47 # MAC-Add | 14 | 13 | 12 | 11 || 10 |
49 # Switch-Port P8 - internal CPU Port
54 device
=`ls /sys/class/net/*/device/driver/1c50000.ethernet/net | head -1`
55 ip link
set $device up
57 # set local mac addresses.
58 ip link
set dev wan address
$SWMAC:10
59 ip link
set dev lan1 address
$SWMAC:11
60 ip link
set dev lan2 address
$SWMAC:12
61 ip link
set dev lan3 address
$SWMAC:13
62 ip link
set dev lan4 address
$SWMAC:14
66 /etc
/init.d
/udev start
73 echo "Usage: ${0} {start}"