Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

examples/gnrc_border_router: static: use router from advertisements by default #19207

Merged
merged 2 commits into from
Jan 27, 2023

Conversation

benpicco
Copy link
Contributor

Contribution description

A router that does not support DHCPv6 IA_PD will typically still support sending router advertisements.
Setting IPV6_DEFAULT_ROUTER by default prevents the node from getting the router config via RAs, leading to a broken configuration.

Setting IPV6_DEFAULT_ROUTER should only be needed in special cases where routes are not advertised.

Testing procedure

examples/gnrc_border_router with PREFIX_CONF=static IPV6_ADDR=2001:1438:400c:7720::7771/64 IPV6_PREFIX=2001:1438:400c:7771::/64:

2023-01-27 18:05:21,780 - INFO # > nib route
2023-01-27 18:05:21,781 - INFO # 
2023-01-27 18:05:21,783 - INFO # 2001:1438:400c:7720::/64 dev #8
2023-01-27 18:05:21,786 - INFO # 2001:1438:400c:7771::/64 dev #7
2023-01-27 18:05:21,790 - INFO # default* via fe80::290:7fff:fed7:c528 dev #8

2023-01-27 18:05:37,000 - INFO # > ifconfig
2023-01-27 18:05:37,000 - INFO #
2023-01-27 18:05:37,054 - INFO # Iface  7  HWaddr: 2A:36  Channel: 26  Page: 0  NID: 0x23  PHY: O-QPSK 
2023-01-27 18:05:37,055 - INFO #           
2023-01-27 18:05:37,060 - INFO #           Long HWaddr: AE:EA:CB:8B:ED:4B:AA:36 
2023-01-27 18:05:37,066 - INFO #            TX-Power: 0dBm  State: IDLE  max. Retrans.: 3  CSMA Retries: 4 
2023-01-27 18:05:37,072 - INFO #           AUTOACK  ACK_REQ  CSMA  L2-PDU:102  MTU:1280  HL:64  RTR  
2023-01-27 18:05:37,075 - INFO #           RTR_ADV  6LO  IPHC  
2023-01-27 18:05:37,078 - INFO #           Source address length: 8
2023-01-27 18:05:37,081 - INFO #           Link type: wireless
2023-01-27 18:05:37,087 - INFO #           inet6 addr: fe80::acea:cb8b:ed4b:aa36  scope: link  VAL
2023-01-27 18:05:37,094 - INFO #           inet6 addr: 2001:1438:400c:7771:acea:cb8b:ed4b:aa36  scope: global  VAL
2023-01-27 18:05:37,097 - INFO #           inet6 group: ff02::2
2023-01-27 18:05:37,099 - INFO #           inet6 group: ff02::1
2023-01-27 18:05:37,103 - INFO #           inet6 group: ff02::1:ff4b:aa36
2023-01-27 18:05:37,104 - INFO #           
2023-01-27 18:05:37,107 - INFO # Iface  8  HWaddr: FC:C2:3D:23:22:DF 
2023-01-27 18:05:37,112 - INFO #           L2-PDU:1500  MTU:1280  HL:64  RTR  
2023-01-27 18:05:37,115 - INFO #           Source address length: 6
2023-01-27 18:05:37,117 - INFO #           Link type: wired
2023-01-27 18:05:37,123 - INFO #           inet6 addr: fe80::fec2:3dff:fe23:22df  scope: link  VAL
2023-01-27 18:05:37,129 - INFO #           inet6 addr: 2001:1438:400c:7720::7771  scope: global  VAL
2023-01-27 18:05:37,136 - INFO #           inet6 addr: 2001:1438:400c:7720:fec2:3dff:fe23:22df  scope: global  VAL
2023-01-27 18:05:37,139 - INFO #           inet6 group: ff02::2
2023-01-27 18:05:37,141 - INFO #           inet6 group: ff02::1
2023-01-27 18:05:37,145 - INFO #           inet6 group: ff02::1:ff23:22df
2023-01-27 18:05:37,149 - INFO #           inet6 group: ff02::1:ff00:7771

Issues/PRs references

@benpicco benpicco requested a review from miri64 January 27, 2023 17:08
@github-actions github-actions bot added Area: examples Area: Example Applications Area: Kconfig Area: Kconfig integration Area: network Area: Networking Area: sys Area: System labels Jan 27, 2023
@benpicco benpicco added Impact: minor The PR is small in size and might only require a quick look of a knowledgeable reviewer CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Area: examples Area: Example Applications and removed Area: network Area: Networking Area: sys Area: System Area: examples Area: Example Applications Area: Kconfig Area: Kconfig integration labels Jan 27, 2023
@benpicco benpicco requested a review from fabian18 January 27, 2023 17:10
@riot-ci
Copy link

riot-ci commented Jan 27, 2023

Murdock results

✔️ PASSED

ff52d35 gnrc_ipv6_nib: use static DNS server from auto_init_sock_dns if present

Success Failures Total Runtime
6796 0 6796 08m:37s

Artifacts

Copy link
Contributor

@fabian18 fabian18 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True.

master:

> nib route
2023-01-27 18:34:47,704 # nib route
2023-01-27 18:34:47,707 # 2001:1438:400c:7720::/64 dev #4
2023-01-27 18:34:47,710 # 2001:1438:400c:7771::/64 dev #5
2023-01-27 18:34:47,713 # default* via fe80::1 dev #4

this:

nib route
2023-01-27 18:37:31,135 # nib route
2023-01-27 18:37:31,137 # 2001:1438:400c:7720::/64 dev #4
2023-01-27 18:37:31,140 # 2001:1438:400c:7771::/64 dev #5
2023-01-27 18:37:31,144 # default via fe80::e5ce:7cba:c468:d8b3 dev #4

@benpicco
Copy link
Contributor Author

Thank you for the quick review!

bors merge

@bors
Copy link
Contributor

bors bot commented Jan 27, 2023

Canceled.

@github-actions github-actions bot added Area: Kconfig Area: Kconfig integration Area: network Area: Networking Area: sys Area: System labels Jan 27, 2023
@benpicco benpicco force-pushed the examples/gnrc_border_router-static_fix branch from 9d34f54 to ff52d35 Compare January 27, 2023 18:15
@benpicco
Copy link
Contributor Author

benpicco commented Jan 27, 2023

One more thing: Those 'basic'¹ routers that need static configuration also don't offer RDNSS.
We can solve this by statically configuring a DNS server via auto_init_sock_dns, but the border router would not advertise this because it has infinite lifetime, so it was considered invalid.

Well, infinite lifetime is just what we want for a statically configured DNS server.
If there really is a RDNSS option, it will overwrite the static configuration anyway.

With this, clients now get DNS without needing to include auto_init_sock_dns themselves:

2023-01-27 19:17:23,905 # Iface  7  HWaddr: 19:C5  Channel: 26  Page: 0  NID: 0x23  PHY: O-QPSK 
2023-01-27 19:17:23,906 #           
2023-01-27 19:17:23,907 #           Long HWaddr: AE:8D:FE:E1:60:ED:99:C5 
2023-01-27 19:17:23,918 #            TX-Power: 0dBm  State: IDLE  max. Retrans.: 3  CSMA Retries: 4 
2023-01-27 19:17:23,920 #           AUTOACK  ACK_REQ  CSMA  L2-PDU:102  MTU:1280  HL:64  6LO  
2023-01-27 19:17:23,921 #           IPHC  
2023-01-27 19:17:23,934 #           Source address length: 8
2023-01-27 19:17:23,935 #           Link type: wireless
2023-01-27 19:17:23,937 #           inet6 addr: fe80::ac8d:fee1:60ed:99c5  scope: link  VAL
2023-01-27 19:17:23,950 #           inet6 addr: 2001:1438:400c:7771:ac8d:fee1:60ed:99c5  scope: global  VAL
2023-01-27 19:17:23,951 #           inet6 group: ff02::1
2023-01-27 19:17:23,951 #           

2023-01-27 19:17:30,542 # > ping google.com
2023-01-27 19:17:30,608 # 12 bytes from 2a00:1450:4001:827::200e: icmp_seq=0 ttl=117 rssi=-34 dBm time=25.812 ms
2023-01-27 19:17:31,602 # 12 bytes from 2a00:1450:4001:827::200e: icmp_seq=1 ttl=117 rssi=-34 dBm time=25.849 ms
2023-01-27 19:17:32,608 # 12 bytes from 2a00:1450:4001:827::200e: icmp_seq=2 ttl=117 rssi=-34 dBm time=25.802 ms
2023-01-27 19:17:32,608 # 
2023-01-27 19:17:32,609 # --- google.com PING statistics ---
2023-01-27 19:17:32,611 # 3 packets transmitted, 3 packets received, 0% packet loss
2023-01-27 19:17:32,622 # round-trip min/avg/max = 25.802/25.821/25.849 ms

I think it still falls under the 'improve static config' umbrella, so I included it here.

[1] It's actually mostly 'enterprise' routers that don't offer those features… Home routers tend to do auto-config just fine.

@fabian18
Copy link
Contributor

ok, let me test this quickly

@fabian18
Copy link
Contributor

sorry I struggle with the setup. I need to do dist/tools/tapsetup/tapsetup -u eth0 and statically assign the global prefix of my ISP router to the border router connected over ethos or is it easier than I think

@fabian18
Copy link
Contributor

and what modules do border router and client need? There are auto_init_sock_dns gnrc_ipv6_nib_dns sock_dns

@benpicco
Copy link
Contributor Author

benpicco commented Jan 27, 2023

The client is just any RIOT application (examples/gnrc_networking, tests/nanocoap_cli) with sock_dns and gnrc_ipv6_nib_dns enabled.

You can't use the same global prefix that is used for your normal network.
e.g. we get 2001:1438:400c:7700::/56 from our ISP and then create subnets within that.

So we have 2001:1438:400c:7720::/64 for the LAN and configured a static route to 2001:1438:400c:7771::/64 via 2001:1438:400c:7720::7771 in the router GUI. (last block of the address and the prefix is the same for convenience as there is a whole block of subnets that follows this scheme).

Now the router will send all packets for 2001:1438:400c:7720::/64 - now we just have to configure a host (the border router) with that address and we can tell it to advertise that network.

Copy link
Contributor

@fabian18 fabian18 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, gonna try it that way another time.
I ment the LAN prefix ::/64, not the ::56, sorry.
I bridged tap0 and eth0 manually this time somehow.

> ping google.com
ping google.com
12 bytes from 2a00:1450:4001:80b::200e: icmp_seq=0 ttl=119 time=30.164 ms
12 bytes from 2a00:1450:4001:80b::200e: icmp_seq=1 ttl=119 time=28.606 ms
12 bytes from 2a00:1450:4001:80b::200e: icmp_seq=2 ttl=119 time=28.638 ms

It makes sense when a static DNS is there it can be advertised with an RDNSS. Anyway I trust you.

@benpicco
Copy link
Contributor Author

bors merge

@bors
Copy link
Contributor

bors bot commented Jan 27, 2023

Build succeeded:

@bors bors bot merged commit c6c84cc into RIOT-OS:master Jan 27, 2023
@benpicco benpicco deleted the examples/gnrc_border_router-static_fix branch January 27, 2023 22:52
@MrKevinWeiss MrKevinWeiss added this to the Release 2023.04 milestone Apr 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: examples Area: Example Applications Area: Kconfig Area: Kconfig integration Area: network Area: Networking Area: sys Area: System CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Impact: minor The PR is small in size and might only require a quick look of a knowledgeable reviewer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants