2021/8/25

dhcpc to resolv.conf, deal with multiple dns

# udhcpc -iwlan0 -A 1 -b 
udhcpc: started, v1.31.1
udhcpc: sending discover
udhcpc: sending select for 192.168.1.100
udhcpc: lease of 192.168.1.100 obtained, lease time 86400
deleting routers
route: SIOCDELRT: No such process
adding dns 168.95.1.1
adding dns 168.95.192.1
所以就..
# udhcpc -iwlan0 -A 1 -b 2>&1 | grep dns | sed 's/adding dns/nameserver/g' > /etc/resolv.conf
看看對不對...
# cat /etc/resolv.conf 
nameserver 168.95.1.1
nameserver 168.95.192.1

沒有留言:

張貼留言