I want to simply send packets from one host to another but I'm confused about how to configure the configuration file and/or src_ip and dst_ip in my Python Script.
Hosts info route:
Host Destination Gateway Genmask
h1 10.0.1.0 10.0.1.10 255.255.255.0
h2 10.0.2.0 10.0.2.20 255.255.255.0
My current ip's configuration file:
- ip: 10.0.1.1 # Port_0 in h1
default_gw: 10.0.2.1 # Port_0 in h2
- ip: 10.0.1.2 # Port_1 in h1
default_gw: 10.0.2.2 # Port_1 in h2
I run the server in h1 with: ./t-rex-64 -i --stl And open another terminal and run a simple ping code:
from trex_stl_lib.api import *
c = STLClient(server = '10.0.1.1')
c.connect()
try:
c.reset(ports = 0)
c.set_service_mode(ports = port_0)
c.set_verbose('normal')
c.ping_ip(src_port = 0, dst_ip = '10.0.2.2', pkt_size = 64, count = 5)
except STLError as e:
print(e)
finally:
c.set_verbose('low')
c.set_service_mode(ports = port_0, enabled = False)
c.disconnect()
I can connect to the server, but my pings never arrive. I believe I'm doing something wrong with my IP's. I've seen some places use 16.0.0.0 and 48.0.0.0 but couldn't find anything else. Any helps is appreciated!