F-Stack / f-stack

F-Stack is an user space network development kit with high performance based on DPDK, FreeBSD TCP/IP stack and coroutine API.
http://www.f-stack.org
Other
3.8k stars 886 forks source link

curl failed because connection refused on vm #585

Open tresaresa opened 3 years ago

tresaresa commented 3 years ago

hi all

i have two ubuntu virtual machines on a window host.

win host: 10.1.1.176 vm1: 10.1.1.177 running the fstack helloworld, the firewall is disabled vm2: 10.1.1.172 not taken over by fstack, can connect to www.bing.com normally

now i'm trying to curl vm1 from vm2, and got connection refused

the window host and two vms are in the same segment 10.1.1.* and connects to the same router.

vm1 ping vm1 -> failed vm2/host ping vm1 -> succeed

and vm2 traceroute vm1 prints a lot of *

traceroute to 10.1.1.177 (10.1.1.177), 30 hops max, 60 byte packets
 1  * * *
 2  * * *
 3  * * *

currently, i set the ipaddr of both veth0 (by using command ifconfig) and f-stack-0 (in f-stack.conf) as 10.1.1.213. and then, i set the gateway of f-stack-0 as 10.1.1.1, which is the same as the one of my host machine and another virtual machine. i'm not sure this way is correct.

root@Lion:/home/tresa# curl -vvv http://10.1.1.177:80
* Rebuilt URL to: http://10.1.1.177:80/
*   Trying 10.1.1.177...
* TCP_NODELAY set
* connect to 10.1.1.177 port 80 failed: connection refused
* Failed to connect to 10.1.1.177 port 80: connection refused
* Closing connection 0
curl: (7) Failed to connect to 10.1.1.177 port 80: connection refused

f-stack.conf of vm1 (all comments are removed)

[dpdk]
lcore_mask=1

channel=4

promiscuous=1
numa_on=1

tx_csum_offoad_skip=0

tso=0

vlan_strip=1

idle_sleep=0

pkt_tx_delay=100

symmetric_rss=0

port_list=0

nb_vdev=0

nb_bond=0

[pcap]
enable = 0
snaplen= 96
savelen= 16777216

[port0]
addr=10.1.1.177
netmask=255.255.225.0
broadcast=10.1.1.255
gateway=10.1.1.1

[kni]
enable=1
method=reject
tcp_port=80,443

[freebsd.boot]
hz=100

fd_reserve=1024

kern.ipc.maxsockets=262144

net.inet.tcp.syncache.hashsize=4096
net.inet.tcp.syncache.bucketlimit=100

net.inet.tcp.tcbhashsize=65536

kern.ncallout=262144

kern.features.inet6=1
net.inet6.ip6.auto_linklocal=1
net.inet6.ip6.accept_rtadv=2
net.inet6.icmp6.rediraccept=1
net.inet6.ip6.forwarding=0

[freebsd.sysctl]
kern.ipc.somaxconn=32768
kern.ipc.maxsockbuf=16777216

net.link.ether.inet.maxhold=5

net.inet.tcp.fast_finwait2_recycle=1
net.inet.tcp.sendspace=16384
net.inet.tcp.recvspace=8192
net.inet.tcp.cc.algorithm=cubic
net.inet.tcp.sendbuf_max=16777216
net.inet.tcp.recvbuf_max=16777216
net.inet.tcp.sendbuf_auto=1
net.inet.tcp.recvbuf_auto=1
net.inet.tcp.sendbuf_inc=16384
net.inet.tcp.recvbuf_inc=524288
net.inet.tcp.sack.enable=1
net.inet.tcp.blackhole=1
net.inet.tcp.msl=2000
net.inet.tcp.delayed_ack=0

net.inet.udp.blackhole=1
net.inet.ip.redirect=0
net.inet.ip.forwarding=0

ifconfig of vm1

root@Lion:/home/tresa# ifconfig
lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (本地环回)
        RX packets 1236  bytes 91632 (91.6 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1236  bytes 91632 (91.6 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

veth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.1.1.177  netmask 255.255.255.0  broadcast 10.1.1.255
        inet6 fe80::a181:bad0:6cc9:958  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:d5:60:f5  txqueuelen 1000  (以太网)
        RX packets 40281  bytes 3807899 (3.8 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1478  bytes 115380 (115.3 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

ff_ifconfig of vm1

root@Lion:/home/tresa# ff_ifconfig
EAL:   Invalid NUMA socket, default to 0
lo0: flags=8008<LOOPBACK,MULTICAST> metric 0 mtu 16384
    options=600003<RXCSUM,TXCSUM,RXCSUM_IPV6,TXCSUM_IPV6>
    groups: lo 
    nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
f-stack-0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
    options=3<RXCSUM,TXCSUM>
    ether 0:c:29:d5:60:f5
    inet 10.1.1.177 netmask 0xffffe100 broadcast 10.1.1.255 
    inet6 fe80::20c:29ff:fed5:60f5 prefixlen 64 scopeid 0x2 
    nd6 options=23<PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL>

ff_netstat -na of vm1

root@Lion:/home/tresa# ff_netstat -na
EAL:   Invalid NUMA socket, default to 0
Active Internet connections (including servers)
Proto Recv-Q Send-Q Local Address          Foreign Address        (state)
tcp4       0      0 *.80                   *.*                    LISTEN
udp4       0      0 *.*                    *.*                   

thanks very much!!!

jfb8856606 commented 3 years ago

It seems access to kernel network, you can enable pcap and see more infomation.