swconfig dev switch0 port 1 set link "speed 100 duplex half" or similar does not work.
I want to set 100MBit/s, half-duplex
You might just need to also turn off auto negotiation. The lines below worked for me to set my WAN port to 100 full duplex (used port 0 and duplex full).
swconfig dev switch0 port 1 set link "duplex half speed 100 autoneg off" swconfig dev switch0 set apply
Which hardware is that? On an MT7621, any "set link" results in "operation not supported". swconfig help suggests that the link parameters are read only.
root@EdgerouterX:~# swconfig dev switch0 help switch0: mt7530(mt7530), ports: 8 (cpu @ 6), vlans: 4095 --switch Attribute 1 (int): enable_vlan (VLAN mode (1:enabled)) Attribute 2 (string): mib (Get MIB counters for switch) Attribute 3 (none): apply (Activate changes in the hardware) Attribute 4 (none): reset (Reset the switch) --vlan Attribute 1 (int): vid (VLAN ID (0-4094)) Attribute 2 (ports): ports (VLAN port mapping) --port Attribute 1 (string): mib (Get MIB counters for port) Attribute 2 (int): pvid (Primary VLAN ID) Attribute 3 (unknown): link (Get port link information) root@EdgerouterX:~# swconfig dev switch0 port 0 get link port:0 link:up speed:1000baseT full-duplex root@EdgerouterX:~# swconfig dev switch0 port 0 set link "speed 1000" Failed to set attribute: Operation not supported
It worked for me on a Netgear Nighthawk R7000. In my case I can't only set the speed, I need to specify the duplex mode too. Try with:
swconfig dev switch0 port 0 set link "speed 1000 duplex full"
swconfig dev switch0 port 0 set link "speed 1000 duplex full autoneg off"