Archive

Posts Tagged ‘ping’

Quickie: Batch file didn’t wait for ping command

October 11th, 2012 No comments

Today I was needed to make batch script to ping some IP addresses for problem described in this article. My first script was as following:

@Echo Off

:Loop1

ping 1.1.1.1 -n 1 -w 30000 >NUL

ping 8.8.8.8 -n 1 | find /i “bytes=” || goto FailedPing

goto Loop1

:FailedPing

echo FAILED PRIMARY NET TO VIA 10.0.0.1 %time% >>ping_test.log

route delete 0.0.0.0 mask 0.0.0.0 10.0.0.1

route add 0.0.0.0 mask 0.0.0.0 10.0.0.2

goto Loop1

When I ran this script in cmd.exe or I scheduled it, it ate one CPU core. I didn’t know why it’s happening, because when I ran this commands in cmd.exe separatelly it workied fine. After couple minutes of debugging I found out that script is not waiting for “ping” commands to finish. It was weird. My colleague told me to use “sleep.exe” to make it wait for a little bit. But that was not a solution. I wanted to force it to wait for ping commands. I tried weird thing. Instead of “ping” I used whole path for ping.exe “%SystemRoot%\\System32\\ping.exe” and for command “route” I used “%SystemRoot%\\System32\\route.exe”. Now everything looks and works perfect.

I have no idea why this is happening, but it works and I need to remember it 🙂

Internal Exchange via two Internet connections

October 11th, 2012 No comments

At one of my customer I had following request. They have Exchange server inside their network. They have two Internet connections. All mail communication goes via primary Internet connection. Second Internet connection is used for Internet browsing.

Internal IP network is 10.0.0.0/24. First Internet connection is called primary and there is default gateway at 10.0.0.1/24. Second Internet connection is called backup Internet connection and it’s default dateway is 10.0.0.2/24. Exchange server has IP address 10.0.0.21/24 and it had default gateway 10.0.0.1/24. MX records are registered to public IP address of primary Internet connection. Problem is when primary line goes down. E-mail communication stops completely – e-mails don’t come and don’t leave company.

To solve this problem we need to make two changes:

  • Change MX records for Internet domain
  • Change routing for internal Exchange server

Read more…

Categories: Exchange, Microsoft, Windows Tags: ,

Windows XP ping (ICMP) payload

October 14th, 2011 No comments

I was wondering what would Windows XP payload to be. I always thought that there will be random characters or something like that, but I was wrong.

Read more…