-
Notifications
You must be signed in to change notification settings - Fork 335
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
T160: nat64: prototype #1408
T160: nat64: prototype #1408
Conversation
This is just a prototype to explore how to integrate tayga into VyOS. |
data/templates/tayga/tayga.conf.j2
Outdated
# | ||
# Optional. | ||
# | ||
{% if stateful.ipv4_pool is defined %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use vyos_defined
src/conf_mode/interfaces-nat64.py
Outdated
@@ -0,0 +1,88 @@ | |||
#!/usr/bin/env python3 | |||
# | |||
# Copyright (C) 2019-2021 VyOS maintainers and contributors |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be 2022 ;)
src/conf_mode/interfaces-nat64.py
Outdated
# bail out early | ||
return None | ||
|
||
verify_vrf(nat64) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see no use of a VRF - I guess its a copy/paste issue ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Besides VRF, I also copy-pasted other common config options like netns
, mtu
, mirror
, redirect
. I assume those options will be honored by the base class method Interface.update
. However I didn't test them. If my assumption is wrong, I can remove them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well we should start low and not asume VRF works out of the box. It needs to be tested and could be added later on. In general I like the idea of a per VRF nat64 gateway - but we need to check if the daemon supports it. Please drop:
- netns
- mirror
- redirect
fab60f8
to
d7df919
Compare
Use [tayga][1] to do NAT64 translation. Example usage: ``` set interfaces nat64 nat64eth0 ipv4-address '192.168.64.1' set interfaces nat64 nat64eth0 ipv6-address '2001:db8::1' set interfaces nat64 nat64eth0 stateful ipv4-pool '192.168.64.0/24' set interfaces nat64 nat64eth0 stateful prefix '2001:db8:64::/96' commit set protocols static route 192.168.64.0/24 interface nat64eth0 set protocols static route6 2001:db8:64::/96 interface nat64eth0 commit ping6 2001:db8:64::8.8.8.8 PING 2001:db8:64::8.8.8.8(2001:db8:64::808:808) 56 data bytes 64 bytes from 2001:db8:64::808:808: icmp_seq=1 ttl=113 time=46.5 ms 64 bytes from 2001:db8:64::808:808: icmp_seq=2 ttl=113 time=47.1 ms 64 bytes from 2001:db8:64::808:808: icmp_seq=3 ttl=113 time=46.7 ms 64 bytes from 2001:db8:64::808:808: icmp_seq=4 ttl=113 time=47.0 ms ^C --- 2001:db8:64::8.8.8.8 ping statistics --- 4 packets transmitted, 4 received, 0% packet loss, time 8ms rtt min/avg/max/mdev = 46.518/46.836/47.138/0.290 ms set interfaces nat64 nat64eth0 host-mapping ipv6 2001:db8:1000::100 ipv4 192.168.64.100 set interfaces nat64 nat64eth0 host-mapping ipv6 2001:db8:1000::101 ipv4 192.168.64.101 commit ``` [1]: http://www.litech.org/tayga/
Fixed MTU check. |
Are you going to implement NAT64? This is a nice feature! |
@jack9603301 Hi, this is just a prototype PR to show how to implement NAT64 with tayga. I just tested the basic functionalities of NAT64 for this PR. It would be nice if someone can take over this work and get it into vyos. Also as I posted in https://phabricator.vyos.net/T160, I know a lot of people want Jool because of its performance. However it would require a much larger effort to integrate and I am not sure how to get the firewall integrated correctly with Jool either. Another concern is that an out-of-tree kernel module could be hard to maintenance in the long term, unless it gets merged into upstream kernel. So my take is:
Another high performance option is using VPP. I don't know if vyos has a plan to integrate VPP, but I do have some thoughts and a working demo to show how to integrate it. |
src/conf_mode/interfaces-nat64.py
Outdated
# bail out early | ||
return None | ||
|
||
verify_vrf(nat64) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well we should start low and not asume VRF works out of the box. It needs to be tested and could be added later on. In general I like the idea of a per VRF nat64 gateway - but we need to check if the daemon supports it. Please drop:
- netns
- mirror
- redirect
src/conf_mode/interfaces-nat64.py
Outdated
shutil.rmtree(configd, ignore_errors=True) | ||
return None | ||
|
||
call(f'systemctl restart tayga@{ifname}.service') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use reload-or-restart
instead. Even it reload is yet not supported we should stick to a pattern if possible.
<help>Description</help> | ||
</properties> | ||
</leafNode> | ||
<leafNode name="disable"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use #include <include/generic-disable-node.xml.i>
instead
</constraint> | ||
</properties> | ||
<children> | ||
<leafNode name="description"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use #include <include/generic-description.xml.i>
I think now may be an opportunity. I found the following link:
Now there is no difficulty in maintaining its kernel module, it seems that debian has helped us maintain it Maybe we need a little experimentation to make sure it works But that means vyos needs to maintain each version of jool-dkms by itself Also about VPP, I don't think vyos should and won't use VPP because VPP depends on DPDK |
python/vyos/ifconfig/nat64.py
Outdated
config_file = f'/run/tayga/{self.ifname}.conf' | ||
call(f"tayga -c {config_file} --mktun") | ||
|
||
def update(self, config): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not required as the base class handles it all.
Thanks for the review and suggestions. I have updated the PR to address all the issues. @jack9603301 Re JOOL, I would like to see a prototype in a separate PR. I may have a look at it as well if I have enough time. |
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
@vfreex could you resolve conflicts? |
@sever-sever This PR means to be a demo and I don't think it is going to be merged as is. I will probably won't keep this PR up to date unless I see people are agreed to implement it this way. |
TAYGA hasn't been updated since 2011 and since it's a userspace implementation, it's going to be a huge performance concern. We will look into adding nftables support to Jool instead. |
Use tayga to do NAT64 translation.
Example usage:
Change Summary
Types of changes
Related Task(s)
Component(s) name
Proposed changes
How to test
Checklist: