a2e4d20e01e3f16f3c74333eace3f65573143291
Static-routes-on-Windows.md
... | ... | @@ -0,0 +1,63 @@ |
1 | +Modern versions of Windows do not support OSPF and manually adding static routes every time after a reboot is annoying. Below is a batch script you can edit and run to help make adding routes easier. This script assumes that your BGP router and Windows computer are on the same LAN. |
|
2 | + |
|
3 | +``` |
|
4 | +@echo off |
|
5 | +REM fill in YOUR network information |
|
6 | +REM right click and RUN AS ADMIN |
|
7 | + |
|
8 | +REM our entire private network address space |
|
9 | +set networkv4=172.20.0.0 |
|
10 | +set networkv4mask=255.252.0.0 |
|
11 | +set networkv6=fd00::/8 |
|
12 | + |
|
13 | +REM our IPv4 subnet info |
|
14 | +set subnetv4=172.20.184.240 |
|
15 | +set subnetv4mask=255.255.255.248 |
|
16 | +set gateway4=172.20.184.241 |
|
17 | + |
|
18 | +REM our IPv6 subnet info |
|
19 | +set subnetv6=fd43:6d1:3ee2::/48 |
|
20 | +set gateway6=fd43:6d1:3ee2:1000::1 |
|
21 | + |
|
22 | +REM our address for this machine |
|
23 | +set yournetaddr=172.20.184.242 |
|
24 | +set yournetaddr6=fd43:6d1:3ee2:1000::2/128 |
|
25 | + |
|
26 | +REM add IPs |
|
27 | +REM if different change wlan0 to YOUR interface name |
|
28 | +REM first line here is for my LAN. Ignore it. |
|
29 | +netsh interface ipv4 add address "wlan0" 192.168.2.254 255.255.255.0 |
|
30 | +netsh interface ipv4 add address "wlan0" %yournetaddr% %subnetv4mask% |
|
31 | +netsh interface ipv6 add address "wlan0" %yournetaddr6% |
|
32 | + |
|
33 | +REM add IPv4 routes |
|
34 | +route -4 add %subnetv4% mask %subnetv4mask% %gateway4% |
|
35 | +route -4 add %networkv4% mask %networkv4mask% %gateway4% |
|
36 | + |
|
37 | +REM add IPv6 routes |
|
38 | +route -6 add %gateway6% :: |
|
39 | +route -6 add %subnetv6% %gateway6% |
|
40 | +REM this last route wasn't working without manually filling in the info. |
|
41 | +REM I don't know why.. Broken line commented out. |
|
42 | +REM route -6 add %networkv6% %gateway6% |
|
43 | +route -6 add fd00::/8 fd43:6d1:3ee2:1000::1 |
|
44 | + |
|
45 | +echo Press enter to check your IPv4 routing table |
|
46 | +echo Do not forget to add static routes to this computer on your BGP router! |
|
47 | +echo Example: "root@router:~# ip route add 172.20.184.242 dev wlan0" |
|
48 | +echo Example: "root@router:~# ip route add fd43:6d1:3ee2:1000::2/128 dev wlan0" |
|
49 | +pause |
|
50 | +cls |
|
51 | +route -4 print |
|
52 | +echo Press enter to check your IPv6 routing table |
|
53 | +pause |
|
54 | +cls |
|
55 | +route -6 print |
|
56 | +echo Press enter to try to ping gateway |
|
57 | +pause |
|
58 | +cls |
|
59 | +ping %gateway4% |
|
60 | +pause |
|
61 | +ping %gateway6% |
|
62 | +pause |
|
63 | +``` |
|
... | ... | \ No newline at end of file |