Last active
August 8, 2018 04:53
-
-
Save greenpeas/0c06d49ad138ceda89376830ec4bc88a to your computer and use it in GitHub Desktop.
Add route for host
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
setlocal EnableDelayedExpansion | |
set myServer=google.ru | |
for /f "tokens=1,2 delims=[]" %%a IN ('ping -n 1 -w 0 !myServer!') DO ( | |
if "%%b" NEQ "" set ip=%%b | |
) | |
rem echo %myServer% ip is %ip% | |
route delete %ip% MASK 255.255.255.255 192.168.137.1 | |
route add %ip% MASK 255.255.255.255 192.168.137.1 | |
rem pause |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# dig +short yandex.ru | |
# getent hosts yandex.ru | awk '{ print $1 }' | |
IP=`host yandex.ru | awk '{ print $4 }'` | |
echo $IP | |
sudo route add -net $IP netmask 255.255.255.255 gw 192.168.137.1 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment