OpenFogStack / celestial

Virtual Software System Testbeds for the LEO Edge
https://openfogstack.github.io/celestial
GNU General Public License v3.0
41 stars 7 forks source link

don't know how to configure #11

Closed ykxian closed 10 months ago

ykxian commented 1 year ago

Hello, I am sorry to disturb you. I really don't know how to solve the problem. I use 3 real workstations(pc6,pc7,pc8) to replace glcoud instance. The IP addresses of them are as follows: pc6:coordinator 192.168.3.46 192.168.1.100(wg0) pc7:host 192.168.3.47 192.168.1.101(wg0) pc8: host 192.168.3.49 192.168.1.102(wg0) pc 6 is the server of wireguard.

Here is my configuration of wireguard: validator.toml

hosts = ["192.168.1.101:1969", "192.168.1.101:1969"]
peeringhosts = ["192.168.1.101:1970", "192.168.1.102:1970"]
database = true
dbhost = "192.168.1.100:8000"

wg0.conf of pc6

[Interface]
Address = 192.168.1.100/24
SaveConfig = true
PostUp = iptables -A FORWARD -i %i -j ACCEPT; iptables -t nat -A POSTROUTING -o wlx0013ef803a83 -j MASQUERADE
PostDown = iptables -D FORWARD -i %i -j ACCEPT; iptables -t nat -D POSTROUTING -o wlx0013ef803a83 -j MASQUERADE
ListenPort = 51820
PrivateKey = +G90vAXLCxQPgQlztreDwYGx8I6euVqB+M1t8sWRSH0=

[Peer]
PublicKey = ANFf3/XR89V61jnPwFvTUchr7JU6A2LIylWObFzLkSQ=
AllowedIPs = 192.168.1.101/32
Endpoint = 192.168.3.47:54716

[Peer]
PublicKey = 8T2f+keUATDvRF13li+Z1RdwsvX1HTF1W8x55YLpFFA=
AllowedIPs = 192.168.1.102/32
Endpoint = 192.168.3.49:55827

wg0.conf of pc7

[Interface]
PrivateKey = ELIf5JAgS3IrPybkvVbmLucDvoR+jV3f1cEqAh6vN0Q= 
Address = 192.168.1.101/24

[Peer]
PublicKey = XEVoe214Rye0DfeimTKX75+60ixhPeCWe2XQmrSFaCU=  
Endpoint = 192.168.3.46:51820
AllowedIPs = 192.168.1.0/24

wg0.conf of pc8

[Interface]
PrivateKey = qE0sZIQL80ohjQ4gZ/mBWO7mQAXffhkPD6SdWalWEG0= 
Address = 192.168.1.102/24

[Peer]
PublicKey = XEVoe214Rye0DfeimTKX75+60ixhPeCWe2XQmrSFaCU=  
Endpoint = 192.168.3.46:51820
AllowedIPs = 192.168.1.0/24                

It works.I can ping pc7,pc8 from pc6. image

When I start the experiment, there is something wrong. image

Could you give me some advice?

pfandzelter commented 11 months ago

Hi @ykxian, sorry for the delay in my answer! I'm not sure if you were able to solve this yourself already, but in short I believe the easiest option for you is to remove the wireguard configuration on your machines, as it might interfere with the wireguard configuration of Celestial (which Celestial automatically configures for you). If the machines are all on the same network (which they appear to be given their IP addresses), then simply enter the IPs into your configuration file:

hosts = ["192.168.3.47:1969", "192.168.3.49:1969"]
peeringhosts = ["192.168.3.47:1970", "192.168.3.49:1970"]
database = true
dbhost = "192.168.3.46:8000"
ykxian commented 10 months ago

Thanks for your reply @pfandzelter! Now I start the experiment as you say.

hosts = ["192.168.3.47:1969", "192.168.3.49:1969"]
peeringhosts = ["192.168.3.47:1970", "192.168.3.49:1970"]
database = true
dbhost = "192.168.3.46:8000"

But it seems that there are still problems in generating keys...

image Sorry to bother you again.

pfandzelter commented 10 months ago

It seems that wireguard is not configuring the keys correctly. Could you please share a screenshot of the output of one of the hosts and the contents of the /celestial directory on the host?

ykxian commented 10 months ago

host pc7: image image Thank you for your assistance.

pfandzelter commented 10 months ago

Turns out there was a bug in handling errors coming out of the Wireguard key generation (which is the likely culprit of your error). Please try again with the latest revision from the main branch. We should then at least see a different error

ykxian commented 10 months ago

OK, I will try it again. Thank you.

ykxian commented 10 months ago

I add a line in remote.go log.SetLevel(log.DebugLevel) image image

pfandzelter commented 10 months ago

Ok, now I see the error. Please move your ~/celestial folder to the root of your drive: /celestial:

sudo mv ~/celestial /celestial

Should do the trick. Currently the paths are hardcoded, although this is something I'm working on at the moment

ykxian commented 10 months ago

image

Thank you very much! It's running fine now.

pfandzelter commented 10 months ago

Sure, let me know if anything else comes up!