- this is a quick bash hack, to set overwrite the current ip with an fixed ip
- or add an virtual interface for an additional fixed ip
- this will (brute force) OVERWRITE all mess done by network managers of various origins
- here should be only one config file to config (to rule them all) network settings and it is:
-
/etc/network/interfaces
- instead of 10x entities inventing it’s own standard, confusing the heck out of users, introducing unecessary complexity (UNIX KISS: KEEP IT SUPER SIMPLE) = asking for trouble
… or it will end up like USB mess of standards: let’s go then:
# become root su - root # install ifconfig legacy tool apt update; apt install net-tools; # checkout what interfaces exist ip -c a 2: enp2s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 # this will simply OVERWRITE the current ip setting of interface # and test ping the system trying to be reached 3x times while true; do ifconfig enp2s0 192.168.2.222 up; ip -c a; ping -c3 192.168.2.223; sleep 1; clear; done # this will ADD additional "virtualinterface:0" fixed ip to interface # so the interface will keep it's dhcp acquired ip plus the fixed ip, cool eh? while true; do ifconfig enp2s0:0 192.168.2.222 up; ip -c a; ping -c3 192.168.2.223; sleep 1; clear; done
this kind of bruteforce way of overwriting things can also be done for DNS: (there should be only ONE config file to config this /etc/resolv.conf, keep the standard!)
alternatively the newer ip command:
# set fixed ip temporarily (resets after reboot) # ip addr add <IP_ADDRESS>/<SUBNET_MASK> dev <INTERFACE> ip addr add 192.168.4.65/24 dev eth0 # set default gateway ip route add default via 192.168.4.1
liked this article?
- only together we can create a truly free world
- plz support dwaves to keep it up & running!
- (yes the info on the internet is (mostly) free but beer is still not free (still have to work on that))
- really really hate advertisement
- contribute: whenever a solution was found, blog about it for others to find!
- talk about, recommend & link to this blog and articles
- thanks to all who contribute!
