Closed QinLongFei closed 4 years ago
Hi there,
As far as I played with the webserver on a VirtualBox machine, you can run it like this:
./webserver2 -i 0 -m 1 -c 1 -s 1 -r ./ -f ./ofp.cli
where
-i 0
- means that you use the first (index 0) of the igb_uio bound interfaces
-m 1
- means that you use direct RSS mode (see ./webserver2 --help)
-c 1
- means that you use only single core (see ./webserver2 --help)
-s 1
- means that you use the core with index 1 (see ./webserver2 --help)
-r ./
- means that you use the current director as root directory for you web server (see ./webserver2 --help)
-f ./ofp.cli
- gives the path to the ofp.cli config file (see ./webserver2 --help)
Hope that helps.
@freak82, Thanks, I will try it.
Hi, freak82,
Thanks your reply. As your suggestion, Now the webserver2 can succeed to run without any errors.
But I notice that the "-l" and "-p" not set. So, ofp will try to bind default IP and PORT(The default ip is 0.0.0.0 and the default port is 2048), Right?
When I tried to assign ip and port to webserver(such as "-l 10.7.103.100 -p 80"), there will be a error like:
I 129973 0:1421195264 httpd2.c:212] Setup webserver.... E 129973 0:1421195264 httpd2.c:247] ofp_bind failed, err='Can't assign requested address'
If I cannot assign a IP to webserver2, How can I access it?
I have tried to assign lots of IP to webserver, like 10..., 192.168.100.(same subnet with CLI), but they all failed.
As far as I recall you pass in the ofp.cli file something like
ifconfig fp0 <ipv4>/<mask>
for example ifconfig fp0 10.20.30.1/24
.
Then you should be able to access the server on this IP even if the latter is bound to 0.0.0.0 (it means listen on all interface IPs).
Thanks!
I tried to modify ofp.cli with ifconfig fp0 10.103.14.199/24.
[root@localhost webserver2]# ip a 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 9: fp0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 500 link/ether 00:0c:29:40:b7:75 brd ff:ff:ff:ff:ff:ff inet 10.103.14.199/24 brd 10.103.14.255 scope global fp0 valid_lft forever preferred_lft forever inet6 2001:470:80b7:670e:20c:29ff:fe40:b775/64 scope global dynamic valid_lft 2591969sec preferred_lft 604769sec inet6 fe80::20c:29ff:fe40:b775/64 scope link valid_lft forever preferred_lft forever
However, I cannot ping this VM from another PC(10.103.14.100). But I can ping 10.10314.100 from this VM. And I can ping 10.103.14.100 on this VM but cannot access http://10.103.14.100 with browser.
I don't know what went wrong. I only config one NIC in this VM.
[root@localhost webserver2]# ip a 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 9: fp0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 500 link/ether 00:0c:29:40:b7:75 brd ff:ff:ff:ff:ff:ff inet 10.103.14.199/24 brd 10.103.14.255 scope global fp0 valid_lft forever preferred_lft forever inet6 2001:470:80b7:670e:20c:29ff:fe40:b775/64 scope global dynamic valid_lft 2591969sec preferred_lft 604769sec inet6 fe80::20c:29ff:fe40:b775/64 scope link valid_lft forever preferred_lft forever
Correct "However, I cannot ping this VM from another PC(10.103.14.100). But I can ping 10.10314.100 from this VM. And I can ping 10.103.14.199 on this VM but cannot access http://10.103.14.199 with browser."
Here is my playing setup that I just revived to try the things again: I have two virtual machines directly connected: The client has ip 10.20.30.1/29 The server, where the webserver2 is running has:
freak82@cache:~/xproxy$ cat ofp.cli
debug 1
loglevel set debug
ifconfig fp0 10.20.30.2/29
and the run command
freak82@cache:~/xproxy$ cat run.sh
#!/bin/bash
# The direct RSS mode is not supported along with multiple queues for
# virtual machines.
# Thus we run it on single core to use single queue only.
./webserver2 -i 0 -m 1 -c 1 -s 1 -r ./ -f ./ofp.cli
And it works from the client
freak82@ubuntu:/z/xfp/ofp/example/webserver2$ wget http://10.20.30.2:2048/
--2020-03-11 13:23:28-- http://10.20.30.2:2048/
Connecting to 10.20.30.2:2048... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified
Saving to: ‘index.html’
If something doesn't work on your setup try to debug the traffic with tcpdump and see if the server returns something to your SYN packets. You can also build the OFP stack and examples with debug enabled and see if you can get some additional information form their debug logs. Here is my configuration for build with enabled debug
./configure \
--prefix=/home/freak82/x3me/xfp/ofp/final \
--enable-shared=no \
--enable-static=yes \
--enable-ipv6=no \
--enable-libconfig=no \
--enable-debug=yes \
--with-config-flv=webserver \
--with-odp=/home/freak82/x3me/xfp/odp_dpdk/final
@freak82 , Thank you very very much!!!
Now it can work well.
Hello,
I'm trying to run webserver or webserver2 examples but always failed.
I have configed odp-dpdk environment on my centOS (https://git.linaro.org/lng/odp-dpdk.git/tree/platform/linux-dpdk/README)
After that, I mount hugepage , insert igb_uio, bind NIC to DPDK(https://github.com/OpenFastPath/ofp/issues/176)
At this time, before bind NIC to DPDK, I have a NIC named ens33, after bind to DPDK, "dpdk-devbind.py --status" show succeed and run "ip a" cannot see this NIC anymore.
Then, I try to run webserver2 , But I cannot pass "-i ens33" to webserver2.
Some error like:
I 6 2:4160671040 ofp_uma.c:45] Creating pool 'udp_inpcb', nitems=1024 size=1160 total=1187840 I 8 2:4160671040 ofp_uma.c:45] Creating pool 'tcp_inpcb', nitems=2048 size=1160 total=2375680 I 9 2:4160671040 ofp_uma.c:45] Creating pool 'tcpcb', nitems=2048 size=784 total=1605632 I 10 2:4160671040 ofp_uma.c:45] Creating pool 'tcptw', nitems=409 size=80 total=32720 I 11 2:4160671040 ofp_uma.c:45] Creating pool 'syncache', nitems=30720 size=168 total=5160960 I 14 2:4160671040 ofp_uma.c:45] Creating pool 'tcpreass', nitems=320 size=48 total=15360 I 15 2:4160671040 ofp_uma.c:45] Creating pool 'sackhole', nitems=65536 size=40 total=2621440 I 17 2:4160671040 ofp_ipsec.c:187] IPsec not supported with SP. Disabling IPsec. I 17 2:4160671040 ofp_init.c:438] Slow path threads on core 0 pktio/socket.c:135:sock_setup_pkt():ioctl(SIOCGIFINDEX): No such device: "ens33". odp_packet_io.c:334:setup_pktio_entry():Unable to init any I/O type. E 20 2:4160671040 ofp_ifnet.c:23] odp_pktio_open failed E 20 2:4160671040 app_main.c:351] Error: OFP global init failed.
If run "webserver2 -i 0", also failed like:
I 7 1:4160671040 ofp_uma.c:45] Creating pool 'udp_inpcb', nitems=1024 size=1160 total=1187840 I 9 1:4160671040 ofp_uma.c:45] Creating pool 'tcp_inpcb', nitems=2048 size=1160 total=2375680 I 10 1:4160671040 ofp_uma.c:45] Creating pool 'tcpcb', nitems=2048 size=784 total=1605632 I 12 1:4160671040 ofp_uma.c:45] Creating pool 'tcptw', nitems=409 size=80 total=32720 I 14 1:4160671040 ofp_uma.c:45] Creating pool 'syncache', nitems=30720 size=168 total=5160960 I 16 1:4160671040 ofp_uma.c:45] Creating pool 'tcpreass', nitems=320 size=48 total=15360 I 17 1:4160671040 ofp_uma.c:45] Creating pool 'sackhole', nitems=65536 size=40 total=2621440 I 20 1:4160671040 ofp_ipsec.c:187] IPsec not supported with SP. Disabling IPsec. I 20 1:4160671040 ofp_init.c:438] Slow path threads on core 0 pktio/socket.c:135:sock_setup_pkt():ioctl(SIOCGIFINDEX): No such device: "0". odp_packet_io.c:334:setup_pktio_entry():Unable to init any I/O type. E 23 1:4160671040 ofp_ifnet.c:23] odp_pktio_open failed E 23 1:4160671040 app_main.c:351] Error: OFP global init failed.
How I run webserver2 with ofp stack?