Hi Asim
I think mOS is very cool project so I followed http://mos.kaist.edu/guide/config/01_inline.html#configuration-steps to test midstat sample app, but I ran into issue below.
I have client, mOS middle box, server connected with direct cable as below:
client (p1p1 10.0.0.6)<--->(dpdk0 10.0.0.7 midstat dpdk1 10.0.1.7) <---> eth0 (10.0.1.8) server
1, I ran command curl on client to send http request to server to see if midstat can forward the request.
2, I configured client to use dpdk0 10.0.0.7 as gateway to server 10.0.1.8 and configured server to use dpdk1 10.0.1.7 as gateway to client 10.0.0.6.
3, I manually added ARP for 10.0.0.7 on client and added ARP for 10.0.1.7 on server
4, I did not manually add any ARP in mOS
here is my detail configuration information:
---client:
ip addr show p1p1
14: p1p1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 00:1b:21:50:bc:38 brd ff:ff:ff:ff:ff:ff
inet 10.0.0.6/24 scope global p1p1
valid_lft forever preferred_lft forever
inet6 fe80::21b:21ff:fe50:bc38/64 scope link
valid_lft forever preferred_lft forever
cat /proc/net/arp
IP address HW type Flags HW address Mask Device
10.0.0.7 0x1 0x6 a0:36:9f:a1:4d:6c * p1p1
ip route show
10.0.1.8 via 10.0.0.7 dev p1p1
----mOS midstat
ip addr show dpdk0
27: dpdk0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 1000
link/ether a0:36:9f:a1:4d:6c brd ff:ff:ff:ff:ff:ff
inet 10.0.0.7/24 brd 10.0.0.255 scope global dpdk0
valid_lft forever preferred_lft forever
inet6 fe80::a236:9fff:fea1:4d6c/64 scope link
valid_lft forever preferred_lft forever
ip addr show dpdk1
28: dpdk1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 1000
link/ether a0:36:9f:a1:4d:6d brd ff:ff:ff:ff:ff:ff
inet 10.0.1.7/24 brd 10.0.1.255 scope global dpdk1
valid_lft forever preferred_lft forever
inet6 fe80::a236:9fff:fea1:4d6d/64 scope link
valid_lft forever preferred_lft forever
ip route show
10.0.0.0/24 dev dpdk0 proto kernel scope link src 10.0.0.7
10.0.1.0/24 dev dpdk1 proto kernel scope link src 10.0.1.7
cat config/mos.conf
######### MOS configuration file
MOS-RELATED OPTIONS
mos {
forward = 1
#######################
##### I/O OPTIONS #####
#######################
# number of memory channels per socket [mandatory for DPDK]
nb_mem_channels = 4
# devices used for MOS applications [mandatory]
netdev {
dpdk0 0x00FF
dpdk1 0x00FF
}
.....................CUT..................
########################
## NETWORK PARAMETERS ##
########################
# This to configure static arp table
# (Destination IP address) (Destination MAC address)
arp_table {
}
# This is to configure static routing table
# (Destination address)/(Prefix) (Device name)
route_table {
}
# This is to configure static bump-in-the-wire NIC forwarding table
# DEVNIC_A DEVNIC_B ## (e.g. dpdk0 dpdk1)
nic_forward_table {
dpdk0 dpdk1
}
..............CUT...........
}
EAL: PCI device 0000:01:00.0 on NUMA socket -1
EAL: probe driver: 8086:1521 rte_igb_pmd
EAL: PCI memory mapped at 0x7f5532c00000
EAL: PCI memory mapped at 0x7f5532d00000
EAL: PCI device 0000:01:00.1 on NUMA socket -1
EAL: probe driver: 8086:1521 rte_igb_pmd
...................
load_module(): 0x86f500
Initializing port 0... done:
Initializing port 1... done:
Checking link status.....................................done
Port 0 Link Up - speed 1000 Mbps - full-duplex
Port 1 Link Up - speed 1000 Mbps - full-duplex
===== MOS configuration =====
| num_cores: 8
| nb_mem_channels: 4
| max_concurrency: 100000
| rmem_size: 8192
| wmem_size: 8192
| tcp_tw_interval: 0
| tcp_timeout: 30000
| multiprocess: false
| mos_log: logs/
| stat_print: dpdk0 dpdk1
| forward: forward
|
+===== Netdev configuration (2 entries) =====
| dpdk0(idx: 0, HADDR: A0:36:9F:A1:4D:6C) maps to CPU 0x00000000000000FF
| dpdk1(idx: 1, HADDR: A0:36:9F:A1:4D:6D) maps to CPU 0x00000000000000FF
|
+===== Static ARP table configuration (0 entries) =====
|
+===== Routing table configuration (4 entries) =====
| IP: 0x00000000, NETMASK: 0x00000000, INTERFACE: br0(idx: 0)
| IP: 0x0A000000, NETMASK: 0xFFFFFF00, INTERFACE: dpdk0(idx: 0)
| IP: 0x0A000100, NETMASK: 0xFFFFFF00, INTERFACE: dpdk1(idx: 1)
| IP: 0xC0A80100, NETMASK: 0xFFFFFF00, INTERFACE: br0(idx: 0)
|
+===== NIC Forwarding table configuration (1 entries) =====
| NIC Forwarding Entry: dpdk0 <---> dpdk1 |
| NIC Forwarding Index Table: |
| 0 --> 1 |
| 1 --> 0 |
| 2 --> -1 |
| 3 --> -1 |
| 4 --> -1 |
| 5 --> -1 |
| 6 --> -1 |
| 7 --> -1 |
| 8 --> -1 |
| 9 --> -1 |
| 10 --> -1 |
| 11 --> -1 |
| 12 --> -1 |
| 13 --> -1 |
| 14 --> -1 |
| 15 --> -1 |
Proto CPU Client Address Client State Server Address Server State
tcp 7 10.0.0.6:54783 SYN_SENT 10.0.1.8:80 SYN_RCVD
----server
ip addr show eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 00:15:60:0e:3d:0a brd ff:ff:ff:ff:ff:ff
inet 10.0.1.8/24 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::215:60ff:fe0e:3d0a/64 scope link
valid_lft forever preferred_lft forever
ip route show
10.0.0.0/24 dev eth0 proto kernel scope link src 10.0.1.8
10.0.0.6 via 10.0.1.7 dev eth0
10.0.1.0/24 dev eth0 proto kernel scope link src 10.0.1.8
cat /proc/net/arp
IP address HW type Flags HW address Mask Device
10.0.1.7 0x1 0x6 a0:36:9f:a1:4d:6d * eth0
tcpdump -nn -e -i eth0
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes
10:06:24.367009 a0:36:9f:a1:4d:6d > a0:36:9f:a1:4d:6c, ethertype IPv4 (0x0800), length 74: 10.0.0.6.54783 > 10.0.1.8.80: Flags [S], seq 539663012, win 29200, options [mss 1460,sackOK,TS val 19265926 ecr 0,nop,wscale 7], length 0
10:06:25.366176 a0:36:9f:a1:4d:6d > a0:36:9f:a1:4d:6c, ethertype IPv4 (0x0800), length 74: 10.0.0.6.54783 > 10.0.1.8.80: Flags [S], seq 539663012, win 29200, options [mss 1460,sackOK,TS val 19266176 ecr 0,nop,wscale 7], length 0
as you can see from above tcpdump on server, there are two things which seems to be wrong:
1 the SYN packet from client 10.0.0.6 to server 10.0.1.8 is suppose to be forwarded by dpdk0 ---> dpdk1, but the source mac and destination MAC is reversed:
dpdk1 a0:36:9f:a1:4d:6d > dpdk 0 a0:36:9f:a1:4d:6c
2 the SYN packet destination MAC should be translated to server MAC 00:15:60:0e:3d:0a, but it is dpdk0 MAC a0:36:9f:a1:4d:6c. thus when server receives the SYN packet, the destination MAC does not exist on server so server did not respond with SYN+ACK and silently dropped
I think I may have missed some configuration. so any clue would be helpful