Pirelli DRG A226M, SWITCH prolem. HELP!

There's no switch function when i installed the firmware.

So, i edited the /etc/config/network as https://openwrt.org/toh/pirelli/drg_a226m suggested.
Now the switch section appeared but got a error message.

Anyone knows what should i change?

config interface loopback                                                       
        option ifname   lo                                                      
        option proto    static                                                  
        option ipaddr   127.0.0.1                                               
        option netmask  255.0.0.0                                               
                                                                                
config 'switch' 'eth1'                                                          
   option 'enable'      '1'                                                     
   option 'enable_vlan' '1'                                                     
   option 'reset'       '1'                                                     
                                                                                
config 'switch_vlan' 'vlan0'                                                    
   option 'vlan'       '0'                                                      
   option 'device'     'eth1'                                                   
   option 'ports'      '0 1 2 5t'                                               
                                                                                
config 'switch_vlan' 'vlan1'                                                    
   option 'vlan'       '1'                                                      
   option 'device'     'eth1'                                                   
   option 'ports'      '3 5t'                                                   
                                                                                
config interface lan                                                            
        option ifname   eth1.0 
        option type     bridge                                                 
        option proto    static                                                  
        option ipaddr   192.168.5.1                                             
        option netmask  255.255.255.0                                           
        option nat      1                                                       
                                                                                
config 'interface' wan 
    option 'ifname'  'eth1.1'                                                   
    option 'proto'   'dhcp'

That wiki page looks wrong.

First off VLAN 0 is not a valid number, VLAN numbers start at 1.

Use swconfig list to get the name of your switch. In almost all cases it is "switch0". Use that in the switch sections.

swconfig dev switch0 help shows the maximum VLAN number, likely 16 on this old chip.

Connect to the router by wifi while tinkering with the switch so you don't block yourself out.

2 Likes

It looks a bit outdated to me.
Try these commands first to identify the switch:

ls -l /sys/class/net
swconfig list
swconfig dev switch0 show

I am almost certain that "option nat 1" in lan interface is not used there.

1 Like

what should i do now?

root@OpenWrt:~# ls -l /sys/class/net
lrwxrwxrwx    1 root     root             0 Nov 24 20:58 br-lan -> ../../devices/virtual/net/br-lan
lrwxrwxrwx    1 root     root             0 Jan  1  1970 eth0 -> ../../devices/platform/bcm63xx_enet.0/net/eth0
lrwxrwxrwx    1 root     root             0 Jan  1  1970 eth1 -> ../../devices/platform/bcm63xx_enet.1/net/eth1
lrwxrwxrwx    1 root     root             0 Jan  1  1970 lo -> ../../devices/virtual/net/lo
lrwxrwxrwx    1 root     root             0 Nov 24 20:58 wlan0 -> ../../devices/pci0000:00/0000:00:01.0/net/wlan0
root@OpenWrt:~# swconfig list
Found: switch0 - eth1
root@OpenWrt:~# swconfig dev switch0 show
Global attributes:
        enable_vlan: 0
        ports: 0x003f
Port 0:
        pvid: 0
        link: port:0 link:down
Port 1:
        pvid: 0
        link: port:1 link:up speed:100baseT full-duplex auto
Port 2:
        pvid: 0
        link: port:2 link:down
Port 3:
        pvid: 0
        link: port:3 link:down
Port 4:
        pvid: 0
        link: port:4 link:down
Port 5:
        pvid: 0
        link: port:5 link:up speed:100baseT full-duplex

What are you trying to do?
Right now VLAN functionality is not enabled in the switch.
The first bit should be

config switch
    option name 'switch0'
    option enable_vlan '1'
    option reset '1'

I wanna set the lan ports 1 2 3 as lan and port 4 as wan.

What is your config file now? Things you need to change are use 'switch0' for the device and use 1 and 2 for the VLANs instead of 0 and 1.

these are the default settings.
I don't know much about routers...
lan ports 1 2 3 as lan and port 4 as wan, thanks.

config interface 'loopback'
        option ifname 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'

config globals 'globals'
        option ula_prefix 'fd1a:e31d:042a::/48'

config interface 'lan'
        option type 'bridge'
        option ifname 'eth1'
        option proto 'static'
        option netmask '255.255.255.0'
        option ip6assign '60'
        option ipaddr '192.168.3.1'

config interface 'wan'
        option ifname 'eth0'
        option proto 'dhcp'

config interface 'wan6'
        option ifname 'eth0'
        option proto 'dhcpv6'

I don't know that model but you need to map out what the ports on the back are actually connected to.

  • are there really two usable CPU Ethernet ports? You can use ip link show and look for the LOWER_UP (as opposed to NO-CARRIER) attribute to see if a cable (or switch chip) is connected to a port.
  • Are the 4 RJ-45 ports on the back just ports on the switch? Again connect a live Ethernet cable to one port at a time and check the switch status with swconfig show to see which one comes up. It looks fairly certain that switch port 5 is one of the CPU ports, it would be eth1 if you've been running LAN on it.


there is only one Ethernet which includes 4 lan ports.
I think that the eth0 is that "TELEFONO" with 2 ports
This is the output when my pc is connected to the 1st lan port

root@OpenWrt:~# swconfig dev switch0 show
Global attributes:
        enable_vlan: 0
        ports: 0x003f
Port 0:
        pvid: 0
        link: port:0 link:up speed:100baseT full-duplex auto
Port 1:
        pvid: 0
        link: port:1 link:down
Port 2:
        pvid: 0
        link: port:2 link:down
Port 3:
        pvid: 0
        link: port:3 link:down
Port 4:
        pvid: 0
        link: port:4 link:down
Port 5:
        pvid: 0
        link: port:5 link:up speed:100baseT full-duplex
root@OpenWrt:~# ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN qlen 1000
    link/ether 02:10:18:01:00:01 brd ff:ff:ff:ff:ff:ff
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel master br-lan state UP qlen 1000
    link/ether 02:10:18:01:00:02 brd ff:ff:ff:ff:ff:ff
4: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
    link/ether 00:1c:a2:b0:4b:94 brd ff:ff:ff:ff:ff:ff
5: br-lan: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP qlen 1000
    link/ether 02:10:18:01:00:02 brd ff:ff:ff:ff:ff:ff

These are the new settings, now everything works, but still gives an error message on luci interface. Too strange...

config interface 'loopback'
        option ifname      'lo'
        option proto       'static'
        option ipaddr      '127.0.0.1'
        option netmask     '255.0.0.0'

config 'switch' 'eth1'
	option name        'switch0'
        option enable      '1'
        option enable_vlan '1'
        option reset       '1'

config 'switch_vlan'
        option vlan        '1'
        option device      'eth1'
        option ports       '0 1 2 5t'

config 'switch_vlan'
        option vlan        '2'
        option device      'eth1'
        option ports       '3 5t'

config interface 'lan'
        option type        'bridge'
        option ifname      'eth1.1'
        option proto       'static'
        option netmask     '255.255.255.0'
        option ip6assign   '60'
        option ipaddr      '192.168.3.1'

config 'interface' 'wan'
        option ifname      'eth1.2'
        option proto       'dhcp'

Take out everything that says eth1 in the switch section. The name is switch0.

Tried these, still the same.

config interface 'loopback'
        option ifname      'lo'
        option proto       'static'
        option ipaddr      '127.0.0.1'
        option netmask     '255.0.0.0'

config 'switch'
	option name        'switch0'
        option enable      '1'
        option enable_vlan '1'
        option reset       '1'

config 'switch_vlan'
        option vlan        '1'
        option device      'eth1'
        option ports       '0 1 2 5t'

config 'switch_vlan'
        option vlan        '2'
        option device      'eth1'
        option ports       '3 5t'

config interface 'lan'
        option type        'bridge'
        option ifname      'eth1.1'
        option proto       'static'
        option netmask     '255.255.255.0'
        option ip6assign   '60'
        option ipaddr      '192.168.3.1'

config 'interface' 'wan'
        option ifname      'eth1.2'
        option proto       'dhcp'
config interface 'loopback'
        option ifname      'lo'
        option proto       'static'
        option ipaddr      '127.0.0.1'
        option netmask     '255.0.0.0'

config 'switch'
	option name        'switch0'
        option enable      '1'
        option enable_vlan '1'
        option reset       '1'

config 'switch_vlan'
        option vlan        '1'
        option device      'switch0'
        option ports       '0 1 2 5t'

config 'switch_vlan'
        option vlan        '2'
        option device      'switch0'
        option ports       '3 5t'

config interface 'lan'
        option type        'bridge'
        option ifname      'eth1.1'
        option proto       'static'
        option netmask     '255.255.255.0'
        option ip6assign   '60'
        option ipaddr      '192.168.3.1'

config 'interface' 'wan'
        option ifname      'eth1.2'
        option proto       'dhcp'

Hi! Did you were able to correct the error?

many thanks!

Actually i did.

pirelli, a226m)
	ucidef_add_switch "switch0" \
		"0:lan" "1:lan" "2:lan" "3:wan" "5t@eth1"
	;;

add this settings to /etc/board.d/02_network
then run

rm /etc/board.json
reboot

You may need to remove the brand name “pirelli” depending on the version of firmware.

Grazie millle! :slight_smile:
At end, after some attemps, I have been able to correct the error. The board name of my device is infact a226m-fwb I copied the settings you suggested me at the begin of 02_network file and in this way it was possible to change the board.json file.

Thank you again!