M
maur
Guest
Hello.
I saw only 2 ways 'how to get network on vps', 1 was just a simple bridge - which is blocked by couple of datacenters, or 2 masquerade.. masquerade is fine enough, but not in all cases (1).
My way is:
When you will have internal lan between host <> nodes you can execute this code:
And code (actually - history log) to execute in vps:
1. I want to get my external ip in webpanel - on vps. and for example when panel will set new vhost apache listening on <external ip> masquerade will break this idea - apache will get request forwarded as local ip targeted.. I hope you understand
2. I know, this is just an history log without many explanation, but i don't really have time now. But maybe it can be helpful for someone.
I saw only 2 ways 'how to get network on vps', 1 was just a simple bridge - which is blocked by couple of datacenters, or 2 masquerade.. masquerade is fine enough, but not in all cases (1).
My way is:
When you will have internal lan between host <> nodes you can execute this code:
m:/etc/network# echo -e "1" > /proc/sys/net/ipv4/conf/all/proxy_arp
m:/etc/network# ip route add <external ip for vps> dev vmbr0
m:/etc/network# arp -i eth0 -Ds <external ip for vps> eth0 netmask 255.255.255.255
m:/etc/network# ip a d <external ip for vps> dev eth0
m:/etc/network# ip route
<external ip for vps> dev vmbr0 scope link
188.40.78.0/26 dev eth0 proto kernel scope link src <external ip of main host>
10.2.10.0/24 dev vmbr0 proto kernel scope link src 10.2.10.1
default via 188.40.78.1 dev eth0
m:/etc/network# ip add
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 1000
link/ether 00:24:21:9c:36:aa brd ff:ff:ff:ff:ff:ff
inet <external ip of main host>/26 brd 188.40.78.63 scope global eth0
inet6 fe80::224:21ff:fe9c:36aa/64 scope link
valid_lft forever preferred_lft forever
6: vmbr0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN
link/ether de:ad:22:29:79:4c brd ff:ff:ff:ff:ff:ff
inet 10.2.10.1/24 brd 10.2.10.255 scope global vmbr0
inet6 fe80::75:f4ff:fee0:f388/64 scope link
valid_lft forever preferred_lft forever
7: vmtab102i0: <BROADCAST,MULTICAST,PROMISC,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 500
link/ether de:ad:22:29:79:4c brd ff:ff:ff:ff:ff:ff
inet6 fe80::dcad:22ff:fe29:794c/64 scope link
valid_lft forever preferred_lft forever
9: vmtab101i0: <BROADCAST,MULTICAST,PROMISC,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 500
link/ether 22:30:13:17:da:bc brd ff:ff:ff:ff:ff:ff
inet6 fe80::2030:13ff:fe17:dabc/64 scope link
valid_lft forever preferred_lft forever
And code (actually - history log) to execute in vps:
gen ~ # ip route
10.2.10.0/24 dev eth0 proto kernel scope link src 10.2.10.10
127.0.0.0/8 dev lo scope link
default via 10.2.10.1 dev eth0
gen ~ # ip add
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 brd 127.255.255.255 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: sit0: <NOARP> mtu 1480 qdisc noop state DOWN
link/sit 0.0.0.0 brd 0.0.0.0
3: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 5a:ac:6d:ed:90:80 brd ff:ff:ff:ff:ff:ff
inet 10.2.10.10/24 brd 10.2.10.255 scope global eth0
inet6 fe80::58ac:6dff:feed:9080/64 scope link
valid_lft forever preferred_lft forever
gen ~ # ip route
10.2.10.0/24 dev eth0 proto kernel scope link src 10.2.10.10
127.0.0.0/8 dev lo scope link
default via 10.2.10.1 dev eth0
gen ~ # ip route del
gen ~ # ip route
10.2.10.0/24 dev eth0 proto kernel scope link src 10.2.10.10
127.0.0.0/8 dev lo scope link
gen ~ # ip a a <external ip of vps>/26 dev eth0
gen ~ # ip route
188.40.78.0/26 dev eth0 proto kernel scope link src <external ip of vps>
10.2.10.0/24 dev eth0 proto kernel scope link src 10.2.10.10
127.0.0.0/8 dev lo scope link
gen ~ # ip add
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 brd 127.255.255.255 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: sit0: <NOARP> mtu 1480 qdisc noop state DOWN
link/sit 0.0.0.0 brd 0.0.0.0
3: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 5a:ac:6d:ed:90:80 brd ff:ff:ff:ff:ff:ff
inet 10.2.10.10/24 brd 10.2.10.255 scope global eth0
inet <external ip of vps>/26 scope global eth0
inet6 fe80::58ac:6dff:feed:9080/64 scope link
valid_lft forever preferred_lft forever
gen ~ # ip route
188.40.78.0/26 dev eth0 proto kernel scope link src <external ip of vps>
10.2.10.0/24 dev eth0 proto kernel scope link src 10.2.10.10
127.0.0.0/8 dev lo scope link
gen ~ # ip route add default via 188.40.78.1
gen ~ # ip a d <external ip of vps> dev eth0
gen ~ # ip route
188.40.78.0/26 dev eth0 proto kernel scope link src <external ip of vps>
10.2.10.0/24 dev eth0 proto kernel scope link src 10.2.10.10
127.0.0.0/8 dev lo scope link
default via 188.40.78.1 dev eth0
gen ~ # ip add
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 brd 127.255.255.255 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: sit0: <NOARP> mtu 1480 qdisc noop state DOWN
link/sit 0.0.0.0 brd 0.0.0.0
3: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 5a:ac:6d:ed:90:80 brd ff:ff:ff:ff:ff:ff
inet 10.2.10.10/24 brd 10.2.10.255 scope global eth0
inet <external ip of vps>/26 scope global eth0
inet6 fe80::58ac:6dff:feed:9080/64 scope link
valid_lft forever preferred_lft forever
1. I want to get my external ip in webpanel - on vps. and for example when panel will set new vhost apache listening on <external ip> masquerade will break this idea - apache will get request forwarded as local ip targeted.. I hope you understand

2. I know, this is just an history log without many explanation, but i don't really have time now. But maybe it can be helpful for someone.