I use a script that creates multiple network interfaces with IP adresses. An example of commands used by the script:
ip addr flush eth0
ip addr flush eth1
ip addr add 192.168.1.10 dev eth0 route add default gw 192.168.1.1 eth0
ip addr add 10.1.1.10 dev eth1 route add default gw 10.1.1.1 eth1
I didn't find an option to set the DNS server. The file at /etc/resolv.conf
has a DNS entry but it's not working. And /etc/network/interfaces
is empty (just loopback information).
My question is : is there a way to set the DNS servers using a cmd line that I can include in the script? Or do I have to manually add all the information to /etc/network/interfaces
?