ansyun / dpdk-ans

ANS(Accelerated Network Stack) on DPDK, DPDK native TCP/IP stack.
https://ansyun.com
BSD 3-Clause "New" or "Revised" License
1.16k stars 324 forks source link

ans test dpdk_tcp_client NAT changed the port #97

Closed codermod closed 5 years ago

codermod commented 5 years ago

Hi, I changed the address in the example I know static address server hardsite. The server requires a connection on port 59000.

But using tcpdump on the router I see that the ip is the same but the port has changed at 53000 or 530001 even if I install port 2000 still on the router becomes 53000

When I put 192.168.0.8 this is my second computer on a home network with Ubuntu 14 on it run the simplest server on the sys/socket.h then the example successfully connects takes bytes of my server and sends it all clearly visible in Wireshark on Ubuntu Windows10 Home VertualBox 5.2.12 Gentoo dpdk 17.11 ans FOR 17.11 Network bridge configure VertualBox My router has static IP root access. The exact same problem and 18.11 is installed but there mangled code that does not disassemble.

my action ./ans –c 0x2 –n 1 –base-virtaddr-0x2aaa2aa0000 -- -p 0x1 --config=”(0,0,1)” –enable-kni –enableipsync I see a lot of text …. Checing link status …… done ……. In another terminal ./anscli ip addr add 192.168.0.5/24 dev veth0 (I enter this term in both cases for connection with the computer in a home network and for attempts to connect with the server on the Internet, is it correct?) running an example to stretch over at terminal with ./ans.... User8: lcore[1] Get route failed based on dest IP (0x9999999…) As an example dpdk_tcp_client to connect to the server on the Internet and not local network?

bluenet13 commented 5 years ago

Don't understand your issue. Please list the steps in detail and share your commands.

codermod commented 5 years ago

Sorry My steps ./ans –c 0x2 –n 1 –base-virtaddr-0x2aaa2aa0000 -- -p 0x1 --config=”(0,0,1)” –enable-kni –enableipsync

EAL: Detected 2 lcore(s) EAL: Probing VFIO support... EAL: PCI device 0000:00:03.0 on NUMA socket -1 EAL: Invalid NUMA socket, default to 0 EAL: probe driver: 8086:100e net_e1000_em KNI is enable IPSYNC is enable param nb 1 ports 1

Start to Init port port 0:
port name net_e1000_em:
max_rx_queues 1: max_tx_queues:1 rx_offload_capa 0xf: tx_offload_capa:0xf Creating queues: rx queue number=1 tx queue number=1... MAC Address:08:00:27:75:B2:38 Deault-- tx pthresh:0, tx hthresh:0, tx wthresh:0, txq_flags:0x0 lcore id:1, tx queue id:0, socket id:0 Conf-- tx pthresh:0, tx hthresh:0, tx wthresh:0, txq_flags:0x0

Allocated mbuf pool on socket 0, mbuf number: 16384

Initializing rx queues on lcore 1 ... Default-- rx pthresh:0, rx hthresh:0, rx wthresh:0 port id:0, rx queue id: 0, socket id:0 Conf-- rx pthresh:8, rx hthresh:8, rx wthresh:4 ans_kni: port_id=0, lcore_id=1, tx queue id=0 KNI: pci: 00:03:00 8086:100e

core mask: 2, sockets number:1, lcore number:1 start to init ans USER8: LCORE[1] lcore mask 0x2 USER8: LCORE[1] lcore id 1 is enable USER8: LCORE[1] lcore number 1 USER1: rte_ip_frag_table_create: allocated of 25165952 bytes at socket 0 USER8: LCORE[1] ANS IP SYNC is enable add veth0 device, kni id 5 USER8: LCORE[1] Interface veth0 if_capabilities: 0xf add IP a000002 on device veth0 show all IPs:

veth0: mtu 1500 link/ether 08:00:27:75:b2:38 inet addr: 10.0.0.2/24

add static route

ANS IP routing table 10.0.0.0/24 via dev veth0 src 10.0.0.2 10.10.0.0/24 via 10.0.0.5 dev veth0

Checking link status ....................done Port 0 Link Up - speed 1000 Mbps - full-duplex USER8: main loop on lcore 1 USER8: -- lcoreid=1 portid=0 rxqueueid=0 nb ports 1 hz: 1900000000

=================================================================

~/work/dpdk-ans/cli/build #./anscli ans> ip addr add 192.168.0.5/24 dev veth0 Add IP address successfully ans>ans> ip addr add 192.168.0.5/24 dev veth0 ans>0K

ip addr show veth0: mtu 1500 link/ether 08:00:27:75:b2:38 inet addr: 10.0.0.2/24 inet addr: 192.168.0.5/24 ans> quit Quit ans command


~/work/dpdk-ans/test/dpdk_tcp_client/build #./dpdk_tcp_client EAL: Detected lcore 0 as core 0 on socket 0 EAL: Detected lcore 1 as core 1 on socket 0 EAL: Support maximum 128 logical core(s) by configuration. EAL: Detected 2 lcore(s) EAL: Probing VFIO support... EAL: Module /sys/module/vfio not found! error 2 (No such file or directory) EAL: VFIO modules not loaded, skipping VFIO support... EAL: Module /sys/module/vfio not found! error 2 (No such file or directory) EAL: Setting up physically contiguous memory... EAL: WARNING: Address Space Layout Randomization (ASLR) is enabled in the kernel. EAL: This may cause issues with mapping memory into secondary processes EAL: Analysing 1000 files EAL: Mapped segment 0 of size 0x200000 EAL: Mapped segment 1 of size 0x200000 EAL: Mapped segment 2 of size 0x66400000 EAL: Mapped segment 3 of size 0x200000 EAL: Mapped segment 4 of size 0x7400000 EAL: Mapped segment 5 of size 0x200000 EAL: Mapped segment 6 of size 0x4600000 EAL: Mapped segment 7 of size 0x2800000 EAL: Mapped segment 8 of size 0x600000 EAL: Mapped segment 9 of size 0x7800000 EAL: Mapped segment 10 of size 0x200000 EAL: Mapped segment 11 of size 0x200000 EAL: TSC frequency is ~1900000 KHz EAL: Master lcore 0 is ready (tid=49c0c8c0;cpuset=[0]) USER8: LCORE[-1] anssock any lcore id 0xffffffff USER8: LCORE[0] anssock app id: 6503 USER8: LCORE[0] anssock app name: dpdk_tcp_client USER8: LCORE[0] anssock app lcoreId: 0 USER8: LCORE[0] mp ops number 6, mp ops index: 0 fd(13) connect to remote server successfully unknow event 1, fd:13 unknow event 1, fd:13 //approximately 3700 unknow event 1, fd:13 fd(12) connect to remote server successfully fd(11) connect to remote server successfully fd(10) connect to remote server successfully fd(9) connect to remote server successfully fd(8) connect to remote server successfully fd(7) connect to remote server successfully fd(6) connect to remote server successfully fd(5) connect to remote server successfully fd(4) connect to remote server successfully unknow event 1, fd:13 start dpdk tcp client application fd(13) recv data, len: 62, num: 0 fd(13) recv data, len: 236, num: 1 fd(4) send len 40, data num 1, total data len:40 fd(5) send len 40, data num 2, total data len:80 fd(6) send len 40, data num 3, total data len:120 fd(7) send len 40, data num 4, total data len:160 fd(13) recv data, len: 16, num: 2 fd(8) send len 40, data num 5, total data len:200 fd(9) send len 40, data num 6, total data len:240 fd(13) recv data, len: 20, num: 3 fd(10) send len 40, data num 7, total data len:280 //--------------- fd(13) send len 40, data num 230, total data len:9200 fd(13) recv data, len: 16, num: 50 fd(4) send len 40, data num 231, total data len:9240 fd(5) send len 40, data num 232, total data len:9280 fd(6) send len 40, data num 233, total data len:9320 fd(7) send len 40, data num 234, total data len:9360 fd(8) send len 40, data num 235, total data len:9400 fd(13) recv data, len: 12, num: 51 ^C================================================================= then I change ip from 192.168.0.8 to external Internet I will rebuild an example

~/work/dpdk-ans/test/dpdk_tcp_client/build #./dpdk_tcp_client EAL: Detected lcore 0 as core 0 on socket 0 EAL: Detected lcore 1 as core 1 on socket 0 EAL: Support maximum 128 logical core(s) by configuration. EAL: Detected 2 lcore(s) EAL: Probing VFIO support... EAL: Module /sys/module/vfio not found! error 2 (No such file or directory) EAL: VFIO modules not loaded, skipping VFIO support... EAL: Module /sys/module/vfio not found! error 2 (No such file or directory) EAL: Setting up physically contiguous memory... EAL: WARNING: Address Space Layout Randomization (ASLR) is enabled in the kernel. EAL: This may cause issues with mapping memory into secondary processes EAL: Analysing 1000 files EAL: Mapped segment 0 of size 0x200000 EAL: Mapped segment 1 of size 0x200000 EAL: Mapped segment 2 of size 0x66400000 EAL: Mapped segment 3 of size 0x200000 EAL: Mapped segment 4 of size 0x7400000 EAL: Mapped segment 5 of size 0x200000 EAL: Mapped segment 6 of size 0x4600000 EAL: Mapped segment 7 of size 0x2800000 EAL: Mapped segment 8 of size 0x600000 EAL: Mapped segment 9 of size 0x7800000 EAL: Mapped segment 10 of size 0x200000 EAL: Mapped segment 11 of size 0x200000 EAL: TSC frequency is ~1900000 KHz EAL: Master lcore 0 is ready (tid=52be68c0;cpuset=[0]) USER8: LCORE[-1] anssock any lcore id 0xffffffff USER8: LCORE[0] anssock app id: 6834 USER8: LCORE[0] anssock app name: dpdk_tcp_client USER8: LCORE[0] anssock app lcoreId: 0 USER8: LCORE[0] mp ops number 6, mp ops index: 0 connect to server failed

USER8: LCORE[1] Get route failed based on dest IP(0x999999) //external Internet address ^C Signal 2 received, preparing to exit... Telling cores to stop... Closing port 0... Done

================================================================= in wireshark on a router in tcpdump I see that the port with 59000 was replaced with 53001. any port I specify in dpdk_tcp_client will be replaced with 53001 but in a local network such doesn't occur, I specified different ports and they didn't change

bluenet13 commented 5 years ago

I think you shall configure a default route for external Internet address(0x999999).

codermod commented 5 years ago

to do this, I can either use anscli? or I can overcome a problem only with settings in the Router?

bluenet13 commented 5 years ago

You can use anscli to configure the default route in ans. ans> ip route add 0.0.0.0/0 via x.x.x.x

bluenet13 commented 5 years ago

no feedback, close it.