Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple internet source setup? #89

Open
Helba0 opened this issue Jul 19, 2023 · 13 comments
Open

Multiple internet source setup? #89

Helba0 opened this issue Jul 19, 2023 · 13 comments

Comments

@Helba0
Copy link

Helba0 commented Jul 19, 2023

Sorry for coming back so early lol. I just wanted to ask if this is possible and for future reference just in case I have to change my source of internet.
Let's say I have multiple sources of internet connection, and want them to be able to run the latency mitigator.
What's the best way of doing this?
Is it setting up another debian VM in Virtualbox and going through all the steps again? or can I just redo all the steps in the same VM, but with different IP addresses this time? I haven't tried it because i'm scared i'll mess the config up.

At certain times, my primary internet connection can be very unstable while running FFXIV, so I tend to use my mobile phone data instead of my primary internet. I thought maybe if I set the adapter bridge to wifi and use my mobile phone data as wifi, it would work. I want to test it out.

@bankjaneo
Copy link

Your current VM will work fine. Beside from setting Bridge adapter to Wi-Fi is change in VM IP address.

When your VM connect to new network, you'll get different IP address. Just use ip addr show or ip a to find your new VM IP and put that to your PS5 network gateway.

Some mobile hotspots may block access between connected clients. In this case, you can't do anything but try different mobile hotspot on other phone.

@Helba0
Copy link
Author

Helba0 commented Jul 20, 2023

Wait, so i just need to change the bridge adapter to wireless, and then change the default gateway on my PS5? I dont need to even setup a new iptables or the vm_ip in the mac terminal?

@Helba0
Copy link
Author

Helba0 commented Jul 20, 2023

An update, I tried it and I think it works. It just didn't post actions in the VM terminal. There's slightly more latency, but I was still able to double weave and it was better compared to before I installed the latency mitigator. Is there away to make it so that it post actions in the VM terminal?

@bankjaneo
Copy link

Wait, so i just need to change the bridge adapter to wireless, and then change the default gateway on my PS5? I dont need to even setup a new iptables or the vm_ip in the mac terminal?

You are correct. Since changing network might also change the subnet. You can use the following command instead for simplicity. It will allow iptables MASQUERADE rule for any IP on outgoing interface. So you don’t need to use your IP in this command.

sudo iptables -t nat -A POSTROUTING -o $(ip route get 8.8.8.8 | awk -- '{printf $5}') -j MASQUERADE

However, you still need to find your VM IP for PS5 network gateway with ip a

Anyway, iptables rules normally reset after each reboot. You can check if the rule is still there by this command.

sudo iptables -t nat -L POSTROUTING -n -v

Or if you want to make sure rule is saved, try installing iptables-persistent

sudo apt install iptables-persistent

Once installed. You can save iptables rule and it will persist on each reboot.

sudo netfilter-persistent save

@bankjaneo
Copy link

An update, I tried it and I think it works. It just didn't post actions in the VM terminal. There's slightly more latency, but I was still able to double weave and it was better compared to before I installed the latency mitigator. Is there away to make it so that it post actions in the VM terminal?

You still need to run the script every time via terminal after your VM started. Then you should see the log right there.

@Helba0
Copy link
Author

Helba0 commented Jul 20, 2023

An update, I tried it and I think it works. It just didn't post actions in the VM terminal. There's slightly more latency, but I was still able to double weave and it was better compared to before I installed the latency mitigator. Is there away to make it so that it post actions in the VM terminal?

You still need to run the script every time via terminal after your VM started. Then you should see the log right there.

by "need to run the script every time" do you mean these script?
cd /home/orca/Python-3.10.0/ && curl
curl https://raw.githubusercontent.com/Soreepeong/XivMitmLatencyMitigator/main/mitigate.py | sudo python3

I tried running the iptables comman you recommended:
root@debian:/home/orca/Python-3.10.0# sudo iptables -t nat -A POSTROUTING -o $(ip route get 8.8.8.8 | awk -- '{printf $5}') -j MASQUERADE
root@debian:/home/orca/Python-3.10.0# sudo apt install iptables-persistent
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
netfilter-persistent
The following NEW packages will be installed:
iptables-persistent netfilter-persistent
0 upgraded, 2 newly installed, 0 to remove and 4 not upgraded.
Need to get 23.4 kB of archives.
After this operation, 91.1 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://deb.debian.org/debian bullseye/main amd64 netfilter-persistent all 1.0.15 [11.0 kB]
Get:2 http://deb.debian.org/debian bullseye/main amd64 iptables-persistent all 1.0.15 [12.4 kB]
Fetched 23.4 kB in 3s (8,989 B/s)
Preconfiguring packages ...
Selecting previously unselected package netfilter-persistent.
(Reading database ... 153050 files and directories currently installed.)
Preparing to unpack .../netfilter-persistent_1.0.15_all.deb ...
Unpacking netfilter-persistent (1.0.15) ...
Selecting previously unselected package iptables-persistent.
Preparing to unpack .../iptables-persistent_1.0.15_all.deb ...
Unpacking iptables-persistent (1.0.15) ...
Setting up netfilter-persistent (1.0.15) ...
Created symlink /etc/systemd/system/multi-user.target.wants/netfilter-persistent
.service → /lib/systemd/system/netfilter-persistent.service.
Setting up iptables-persistent (1.0.15) ...
update-alternatives: using /lib/systemd/system/netfilter-persistent.service to p
rovide /lib/systemd/system/iptables.service (iptables.service) in auto mode
Processing triggers for man-db (2.9.4-2) ...
root@debian:/home/orca/Python-3.10.0# sudo netfilter-persistent save
run-parts: executing /usr/share/netfilter-persistent/plugins.d/15-ip4tables save
run-parts: executing /usr/share/netfilter-persistent/plugins.d/25-ip6tables save

When I tried using the wired connection, it works fine. it detected a new login, then posts actions in the vm terminal like usual. When i switched to mobile phones after restarting everything and changing my bridge adapter to wireless, the vm terminal still hasn't post anything. but it still works. there are actions i would never be able to perform without using the latency mitigator. It just kind of made me doubt myself not knowing if it's working or not hahaha

@bankjaneo
Copy link

bankjaneo commented Jul 20, 2023

Yes, you need to run this command every time you start your VM

cd /home/orca/Python-3.10.0/ && curl https://raw.githubusercontent.com/Soreepeong/XivMitmLatencyMitigator/main/mitigate.py | sudo python3

For the bridge adapter, you need to shutdown VM before changing it. Connect to your new network (i.e. mobile hotspot) and then start the VM.

Can you also show me the result of this command?

sudo iptables -t nat -L POSTROUTING -n -v

@Helba0
Copy link
Author

Helba0 commented Jul 20, 2023

Yes I tried changing the bridge adapter after powering down the VM, because you can't change it while it's running I think. I didn't restart virtualbox though, I thought it was unnecessary. Here you go:

root@debian:/home/orca# sudo iptables -t nat -L POSTROUTING -n -v
Chain POSTROUTING (policy ACCEPT 3 packets, 332 bytes)
pkts bytes target prot opt in out source destination
23 1719 MASQUERADE all -- * enp0s3 0.0.0.0/0 0.0.0.0/0

@bankjaneo
Copy link

bankjaneo commented Jul 20, 2023

iptables rule is fine for any network you are going to use in the future now.

You need to restart VM every time you changed network related settings.

After restarted, check your VM IP (ip a) again, it should change into something different than the one you had. Then connect your PS5 to the same network and set this new IP as PS5 network gateway.

@Helba0
Copy link
Author

Helba0 commented Jul 20, 2023

root@debian:/home/orca# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 08:00:27:a3:c7:04 brd ff:ff:ff:ff:ff:ff
inet 172.20.10.14/28 brd 172.20.10.15 scope global dynamic noprefixroute enp0s3
valid_lft 84156sec preferred_lft 84156sec
inet6 fe80::a00:27ff:fea3:c704/64 scope link noprefixroute
valid_lft forever preferred_lft forever

Ah I mistyped 172.20.10.1 instead of 172.20.10.14 on the ps5 default gateway. but now that I have the correct default gateway for the ps5, it won't connect to the internet, just like what you said might happened earlier. so all this time I thought it was working, i don't think it wasn't :(

@bankjaneo
Copy link

It means you can double weave some skills if your heart believe it 😁.

In theory, you may try using mobile hotspot via USB cable with your MacBook. Then goto System Preferences -> Sharing (or something around this. I'm not sure, I haven't use Mac for years already) and create Wi-Fi hotspot with your MacBook instead.

Anyway, in this case, I'm also not sure what adapter name to set in VirtualBox bridge network setting too.

@Helba0
Copy link
Author

Helba0 commented Jul 20, 2023

It means you can double weave some skills if your heart believe it 😁.

In theory, you may try using mobile hotspot via USB cable with your MacBook. Then goto System Preferences -> Sharing (or something around this. I'm not sure, I haven't use Mac for years already) and create Wi-Fi hotspot with your MacBook instead.

Anyway, in this case, I'm also not sure what adapter name to set in VirtualBox bridge network setting too.

🤣🤣 I truly believed it was smoother… I just wanted to believe the lies.. anyways. I’ll try it again tonight, see if I might did something wrong.

Ah it might be a good idea to turn the mac into a hotspot. For the adapter name set.. maybe wired? If i’m not mistaken it also has a thunderbolt settings too.

@Helba0
Copy link
Author

Helba0 commented Jul 26, 2023

I actually tried using the Iphone usb method. sadly when I connected it through USB cable, my laptop just won't connect to the internet the way a wi-fi personal hotspot does. The VM actually has an Iphone usb bridge adapter settings. I was so close... I guess it's just the ISP. I'll try other ISP to see if there's anything that will allow this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants