From https://forum.openwrt.org/viewtopic.php?id=19640

[quote]
Restart router in failsafe mode (differs by router, but for the WRT54GL and other linksys):
1. restart router, when DMZ light comes on, hold reset for 3 seconds until DMZ light starts flashing.
2. at this point connect computer directly to port 1 on router.
3. give computer static ip of 192.168.1.155.
4. restart networking on computer.
5. run: telnet 192.168.1.1 -l root
Run ‘firstboot’
Run ‘sync’
Run ‘passwd’ to reset root password.
Fix computer networking and restart the router.
Now log in as normal.
[/quote]

to get static ip with ip tools:
[quote]
Manual assignment
Enable the network interface:
# ip link set interface up

Assign a static IP address in the console:
# ip addr add IP_address/subnet_mask broadcast broadcast_address dev interface

For example:
# ip addr add 192.168.1.2/24 broadcast 192.168.1.255 dev interface

For more options, see man ip.
Add your gateway IP address like so:
# ip route add default via default_gateway

For example:
# ip route add default via 192.168.1.1
[/quote]