Giter VIP home page Giter VIP logo

Comments (4)

thehajime avatar thehajime commented on September 15, 2024

as you guess, LKL_HIJACK_NET_GATEWAY is used to configure route info of LKL stack. just do like ip route add default; no tap device specific and no relations to host kernel device.

(crafted from tests/hijack-test.sh, not tested yet)

sudo brctl addbr br0
sudo brctl addif eth0 (which is connected to 192.168.13.254, gateway, for instance)
sudo brctl addif lkl_ptt0

LKL_HIJACK_NET_TAP=lkl_ptt0 LKL_HIJACK_NET_IP=192.168.13.2 LKL_HIJACK_NET_NETMASK_LEN=24  LKL_HIJACK_NET_GATEWAY=192.168.13.254 ${hijack_script} ./ping 8.8.8.8

as you can see, LKL_HIJACK_NET_GATEWAY=192.168.13.254 is the key part.

from linux.

xjia1 avatar xjia1 commented on September 15, 2024

Is your example assuming that the LKL and the host are on the same network? What if I only want the LKL to be able to talk to the host? For example the host may have eth0 IP 10.x.x.x while LKL is 192.168.13.x.

from linux.

tommie-lie avatar tommie-lie commented on September 15, 2024

If you just want LKL to be able to talk to the host, the easiest (and to some extent unclean) way is shown in the tools/lkl/tests/hijack-test.sh: Create a tap device (in the host) and set it up to be in the same network as you configure LKL. Then you don't need a gateway at all (as the machines are in the same network) and you can communicate between host and LKL directly without problems. The host's traffic to other networks (your home/company network or "the internet") is not affected by the setup from hijack-test.sh at all. So it is a safe setup if you only want "host-only" networking in LKL.

A gateway is only needed to forward traffic from one network to another and must be reachable in both networks. So, in your example with the host's only address in the 10.0.0.0/8 network and LKL in 192.168.13.0/24, you need to have a gateway between the two networks. In order to set one up, you have to add a tap device (in addition to your eth0), put in in the 10.0.0.0/24 network, and set up NAT on your host, including proper iptables entries to forward packets from one network/device to the other.

And yes, @thehajime's example only works when both, LKL and the host are in the 192.168.13.0/24 network (and eth0 is not configured as 192.168.13.2) :-)

from linux.

pscollins avatar pscollins commented on September 15, 2024

Okay, thanks! The issue I was having was that I was running netserver under LKL and I couldn't get a netperf instance on the host to talk to it. I was able to get it connected after messing with the routing table to stop the host kernel from trying to go through lo and then changing LKL_HIJACK_NET_NETMASK_LEN so that the host and LKL were on the same subnet. I'm having an issue now with LKL's netserver hanging; I'll probably open another issue about that if I can't get it resolved.

from linux.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.