废话不多 直接命令
由于wget不支持端口绑定 所以只能使用ip绑定方式 所以需要配合ifconfig
通过eth0的ipv4访问百度
wget --bind-address=$(ifconfig eth0 | grep 'inet ' | cut -d' ' -f2-10 | awk '{print $2}') --no-check-certificate -q -O - https://baidu.com --timeout=5 --tries=1
通过wlan0的ipv6访问百度
wget --bind-address=$(ifconfig wlan0 | grep 'inet6 ' | cut -d' ' -f2-10 | awk '{print $2}') --no-check-certificate -q -O - https://baidu.com --timeout=5 --tries=1
如果你的系统支持curl那么推荐你使用curl的方式
文章评论