How to properly use route table in my case?

2

I know that there are many tutorial and probably topics about it, but I just can't configure it to work for me. I hope someone could help me :) I'm using Windows 10, but it shouldn't be problem.

So, first here is the website (for example) I'd like to block: http://www.uni-pannon.hu/

Pinging returns:

C:\Windows\system32>ping www.uni-pannon.hu

Pinging www.uni-pannon.hu [193.6.32.90] with 32 bytes of data:
Reply from 193.6.32.90: bytes=32 time<1ms TTL=62
Reply from 193.6.32.90: bytes=32 time<1ms TTL=62
Reply from 193.6.32.90: bytes=32 time<1ms TTL=62
Reply from 193.6.32.90: bytes=32 time<1ms TTL=62

Ping statistics for 193.6.32.90:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 0ms, Average = 0ms

My default gateway seems to be the following:

Ethernet adapter Ethernet:

   Connection-specific DNS Suffix  . : vekoll.uni-pannon.hu
   Description . . . . . . . . . . . : Realtek PCIe FE Family Controller
   Physical Address. . . . . . . . . : 74-86-7A-1B-5E-A7
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes
   Link-local IPv6 Address . . . . . : fe80::e909:6fbe:a499:2979%8(Preferred)
   IPv4 Address. . . . . . . . . . . : 10.3.1.122(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.0.0
   Lease Obtained. . . . . . . . . . : 2016. január 6., szerda 3:30:58
   Lease Expires . . . . . . . . . . : 2016. január 7., csütörtök 18:01:52
   Default Gateway . . . . . . . . . : 10.3.0.1
   DHCP Server . . . . . . . . . . . : 10.3.0.1
   DHCPv6 IAID . . . . . . . . . . . : 74745466
   DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-1E-0E-41-5B-74-86-7A-1B-5E-A7
   DNS Servers . . . . . . . . . . . : 193.6.40.4
                                   193.6.40.2
   NetBIOS over Tcpip. . . . . . . . : Enabled

So, as a route gateway I choose an unreachable host:

C:\Windows\system32>ping 10.3.0.100

Pinging 10.3.0.100 with 32 bytes of data:
Reply from 10.3.1.100: Destination host unreachable.
Reply from 10.3.1.100: Destination host unreachable.
Reply from 10.3.1.100: Destination host unreachable.
Reply from 10.3.1.100: Destination host unreachable.

Ping statistics for 10.3.0.100:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),

Based on the datails I copied above, I "crafted" the following command:

route -p add 193.6.32.90 mask 255.255.255.0 10.3.1.100

After successfully adding this route, I tried to ping 193.6.32.90 and both the website, but I could reach both of them. Then I tried to access the website via browser, but it's still available.

Could anyone tell me where did I fail? Before anyone telling me to use hosts file, I'd like to find a different method to block websites (via native windows solutions).

Edit: Tried flushing as it's shown here: https://stackoverflow.com/questions/9739156/how-to-flush-route-table-in-windows

Edit2: After trying to add a route which a comment suggested, here's my whole route table:

http://pastebin.com/raw/3CGHSCKx

original.roland

Posted 2016-01-06T23:48:50.520

Reputation: 133

2first the mask should be 255.255.255.255, which may affect the "specificity" of the result. if you want your custom route to be evaluated first, it must be the most specific, lowest metric, route to the destination, so confirm your custom routes metric is lower than the default gateway. it may help us help you if you post your route table. – Frank Thomas – 2016-01-07T01:00:26.220

try route -p add 193.6.32.90 mask 255.255.255.255 127.0.0.1 1 – Frank Thomas – 2016-01-07T03:25:09.683

Not even the route you told blocked the desired website. I added my whole rout table (route print) as a pastebin link to the main question. ( http://pastebin.com/raw/3CGHSCKx )

– original.roland – 2016-01-07T09:53:45.780

If your goal is to create a blacklist you could edit the hosts file. Simply put an entry (www.badsite.com, for example) pointing to the localhost (127.0.0.1). – Adriano P – 2016-01-16T03:25:31.380

Answers

1

You can create a null route using the below example. (My destination 74.125.200.100)

First issue the command netstat -nr and find Loopback interface number under interface list section.

C:\Users\Administrator>netstat -nr
===========================================================================
Interface List
 11...00 0c 29 0d bc c9 ......Intel(R) PRO/1000 MT Network Connection
  1...........................Software Loopback Interface 1
 12...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter

Then add below route pointing with the loopback interface number.

route add 74.125.200.100 mask 255.255.255.255 1.1.1.1 metric 1 if 1

This should block the destination as shown in the image.See my screenshot

manjesh23

Posted 2016-01-06T23:48:50.520

Reputation: 1 404

Thank you, sorry for late response, soon I'll be able to test it, but at the moment I'm not at computer. I'll reply as soon as possible! :) – original.roland – 2016-01-08T18:15:49.600

This seems to do it's job, but I can't understand a thing. After addig the line you told, I can no longer ping the destination, but I can still access the website by it's link.Is it possible to block access to the website with routing? – original.roland – 2016-01-08T22:02:58.767

I will have to check on that, currently I am on my vacation and will reply on Monday. – manjesh23 – 2016-01-08T23:29:57.640

Could you check it? – original.roland – 2016-01-16T11:45:37.490

@original.roland, Sorry totally forgot to check, I just tested this with 74.125.200.100 which is Google. When I add the route I was not able to ping 74.125.200.100 and no data for this IP on web browser (Chrome) as well. Even telnet 74.125.200.100 80 failed. This route is blocking all services for 74.125.200.100, once I delete the route, everything is working as normal. I would suggest you to check this route with 74.125.200.100 and let me know if this works. – manjesh23 – 2016-01-16T16:19:58.513

@original.roland, In your case http://www.uni-pannon.hu resolving to 193.6.32.90, if I type http://www.uni-pannon.hu/ in web browser I am getting the page but if I type in the IP 193.6.32.90 in web browser I don't get the page. Because http://www.uni-pannon.hu/ is hosted on a shared server which also has techtarget.com and by IP we are not able to isolate the 2 web servers listening on the same port number (inside). You can check this reverse IP domain lookup at http://www.yougetsignal.com/tools/web-sites-on-web-server

I just tested your website 193.6.32.90 and this is blocked by above route.

– manjesh23 – 2016-01-16T16:29:22.210

@manjesh5 Thank you, More or less I understand. I'm interested if I can block any website coming from a given IP? I don't care if it's shared and there are multiple website addresses associated to that IP, I can "afford" to block all of them. – original.roland – 2016-01-16T22:04:13.683