Date: Sun, 5 May 2024 09:20:54 +0200 From: Mario Marietto <marietto2008@gmail.com> To: Apoorv Sachan <apoorv.99.sachan@gmail.com> Cc: "freebsd-net@FreeBSD.org" <freebsd-net@freebsd.org> Subject: Re: How to configure the networking on FreeBSD to assign the same IP between host and guest in order to make work CloudFlare Warp on FreeBSD Message-ID: <CA%2B1FSiitgGOF8_f4CZWHN2feW1fKBW263qo8KC6zWJ1%2BeAoiHA@mail.gmail.com> In-Reply-To: <CA%2B1FSihhabnE3L9qeqoEFNZPYc0%2BWLtEZX-=vJ1T9f8w94FHRg@mail.gmail.com> References: <CA%2B1FSijvmDM_54ytL_E2vAUvo9MPWyfTCbDRtpyjbhUdf4_ZEw@mail.gmail.com> <CALTLgQw8n-CEx0npV7SMq2=4BdPh8v7WorXXLHqG_0QwsB9Rqw@mail.gmail.com> <CA%2B1FSihhabnE3L9qeqoEFNZPYc0%2BWLtEZX-=vJ1T9f8w94FHRg@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--0000000000003e57d40617afcd5a Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable This is what I did : on FreeBSD : /etc/rc.conf : ifconfig_em0=3D"inet 192.168.1.5 netmask 255.255.255.0" defaultrouter=3D"192.168.1.10" On Ubuntu : echo 1 > /proc/sys/net/ipv4/ip_forward iptables -A PREROUTING -t nat -p tcp -d 192.168.1.10 -j DNAT --to-destination 192.168.1.5 iptables -A POSTROUTING -t nat -o enp0s13 -j MASQUERADE warp-cli connect What's the problem ? I'm able to connect to Ubuntu,but on FreeBSD I can't surf. On Sat, May 4, 2024 at 9:29=E2=80=AFPM Mario Marietto <marietto2008@gmail.c= om> wrote: > So. Please help me further... > > Let's say that the IP number assigned to Ubuntu is 192.168.1.9,on FreeBSD > I do : > > /etc/rc.conf : > > defaultrouter=3D"192.168.1.9" > > ? even if the VM starts after the booting of FreeBSD ? > > About configuring the DNAT iptables rule I have no idea. Please help me t= o > understand how to do it. > > On Sat, May 4, 2024 at 9:22=E2=80=AFPM Apoorv Sachan <apoorv.99.sachan@gm= ail.com> > wrote: > >> Hi Mario >> >> You can set the ip if the Ubuntu machine as the default route on the >> freeBSD host. >> This will take all the traffic oroginating in freeBSD host through the >> warp-tunnel. >> >> And configure a DNAT iptables rule in the Ubuntu machine to return the >> traffic back to freeBSD machine. >> >> This way you could utilise the warp-cloud flare tunnel from the freeBSD >> host even though it runs on the Ubuntu guest. And both have different IP= s. >> >> On Sun, 5 May 2024 at 12:23=E2=80=AFAM, Mario Marietto <marietto2008@gma= il.com> >> wrote: >> >>> Hello. >>> >>> I've just installed the CloudFlare client + GUI on Ubuntu,that I have >>> virtualized with bhyve. Cloudflare does not work on FreeBSD. The >>> instructions that I have followed are located here : >>> >>> https://youtu.be/4JuOUjCSj44 >>> >>> Installing it in this way,it will run only on the IP assigned to Ubuntu >>> inside the VM. For me the IP of FreeBSD is different from the IP assign= ed >>> to Ubuntu. Configured in this way it's not useful. >>> >>> I want Cloudflare to take the IP address of FreeBSD. >>> >>> To achieve this goal,I should change my network configuration,in a way >>> that I use the same IP for FreeBSD and Ubuntu. >>> >>> That's what I want to do,but I don't know how to do it. But I'm sure >>> that I will be able to do it if someone can give me some advice. >>> >>> I can explain how I have configured my network,so you can explain what = I >>> should change to have the same IP. >>> >>> For example,to boot Ubuntu with bhyve,I use the following parameter : >>> >>> -s 13,virtio-net,tap19 \ >>> >>> >>> /etc/rc.conf : >>> >>> ifconfig_em0=3D"DHCP" >>> local_unbound_enable=3D"YES" >>> cloned_interfaces=3D"bridge0 tap0 tap1 tap2 tap3 tap4 tap5 tap6 tap7 ta= p8 tap9 tap10 tap11 tap12 tap13 tap14 tap15 tap16 tap17 tap18 tap19 tap20 e= m0" >>> ifconfig_bridge0=3D"addm em0 addm tap0 addm tap1 addm tap2 addm tap3 ad= dm tap4 addm tap5 addm tap6 addm tap7 addm tap8 addm tap9 addm tap10 addm t= ap11 addm tap12 addm tap13 addm tap14 addm tap15 addm tap16 addm tap17 addm= tap18 addm tap19 addm tap20" >>> >>> >>> /boot/loader.conf >>> >>> if_tap_load=3D"YES" >>> if_bridge_load=3D"YES" >>> bridgestp_load=3D"YES" >>> >>> >>> /etc/sysctl.conf >>> >>> net.link.tap.up_on_open=3D1 >>> net.inet.ip.forwarding=3D1 >>> net.inet.ip.random_id=3D1 >>> >>> >>> So,ok. I think you have understood what I want to do. Please help me. >>> Thanks. >>> >>> -- >>> Mario >>> >> > > -- > Mario. > --=20 Mario. --0000000000003e57d40617afcd5a Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><div class=3D"gmail-message-userContent gmail-lbContainer = gmail-js-lbContainer"> =09 =09 =09 =09 =09 <div> =09 <div class=3D"gmail-bbWrapper">This is what I did :<br> <br> on FreeBSD :<br> <br> /etc/rc.conf :<br> <br> ifconfig_em0=3D"inet 192.168.1.5 netmask 255.255.255.0"<br> defaultrouter=3D"192.168.1.10"<br> <br> On Ubuntu :<br> <br> echo 1 > /proc/sys/net/ipv4/ip_forward<br> iptables -A PREROUTING -t nat -p tcp -d 192.168.1.10 -j DNAT --to-destinati= on 192.168.1.5<br> iptables -A POSTROUTING -t nat -o enp0s13 -j MASQUERADE<br> warp-cli connect<br> <br> What's the problem ? I'm able to connect to Ubuntu,but on FreeBSD I= can't surf.</div></div></div></div><br><div class=3D"gmail_quote"><div= dir=3D"ltr" class=3D"gmail_attr">On Sat, May 4, 2024 at 9:29=E2=80=AFPM Ma= rio Marietto <<a href=3D"mailto:marietto2008@gmail.com">marietto2008@gma= il.com</a>> wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"m= argin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left= :1ex"><div dir=3D"ltr"><div>So. Please help me further...</div><div><br></d= iv><div>Let's say that the IP number assigned to Ubuntu is 192.168.1.9,= on FreeBSD I do :</div><div><br></div><div>/etc/rc.conf :</div><div><br></d= iv><div>defaultrouter=3D"192.168.1.9"</div><div><br></div><div>? = even if the VM starts after the booting of FreeBSD ? <br></div><div><br></d= iv><div>About configuring the DNAT iptables rule I have no idea. Please hel= p me to understand how to do it. <br></div></div><br><div class=3D"gmail_qu= ote"><div dir=3D"ltr" class=3D"gmail_attr">On Sat, May 4, 2024 at 9:22=E2= =80=AFPM Apoorv Sachan <<a href=3D"mailto:apoorv.99.sachan@gmail.com" ta= rget=3D"_blank">apoorv.99.sachan@gmail.com</a>> wrote:<br></div><blockqu= ote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px= solid rgb(204,204,204);padding-left:1ex"><div dir=3D"auto">Hi Mario=C2=A0<= /div><div dir=3D"auto"><br></div><div dir=3D"auto">You can set the ip if th= e Ubuntu machine as the default route on the freeBSD host.=C2=A0</div><div = dir=3D"auto">This will take all the traffic oroginating in freeBSD host thr= ough the warp-tunnel.</div><div dir=3D"auto"><br></div><div dir=3D"auto">An= d configure a DNAT iptables rule in the Ubuntu machine to return the traffi= c back to freeBSD machine.=C2=A0</div><div dir=3D"auto"><br></div><div dir= =3D"auto">This way you could utilise the warp-cloud flare tunnel from the f= reeBSD host even though it runs on the Ubuntu guest. And both have differen= t IPs.</div><div><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"g= mail_attr">On Sun, 5 May 2024 at 12:23=E2=80=AFAM, Mario Marietto <<a hr= ef=3D"mailto:marietto2008@gmail.com" target=3D"_blank">marietto2008@gmail.c= om</a>> wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"margi= n:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex= "><div dir=3D"ltr">Hello.<br> <br><div> I've just installed the CloudFlare client + GUI on Ubuntu,that I have= =20 virtualized with bhyve. Cloudflare does not work on FreeBSD. The=20 instructions that I have followed are located here :</div><div><br></div><d= iv><a href=3D"https://youtu.be/4JuOUjCSj44" target=3D"_blank">https://youtu= .be/4JuOUjCSj44</a></div><div><br></div><div>Installing it in this way,it w= ill run only on the IP assigned to Ubuntu=20 inside the VM. For me the IP of FreeBSD is different from the IP=20 assigned to Ubuntu. Configured in this way it's not useful.=C2=A0</div>= <div><br></div><div>I want Cloudflare to take the IP address of FreeBSD.</d= iv><div><br></div><div> To achieve this goal,I should change my network configuration,in a way that= I use the same IP for FreeBSD and Ubuntu.<br> </div><div><br></div><div>That's what I want to do,but I don't know= how to do it. But I'm sure=20 that I will be able to do it if someone can give me some advice. <br></div>= <div><br></div><div> I can explain how I have configured my network,so you can explain what I sh= ould change to have the same IP.<br> <br> For example,to boot Ubuntu with bhyve,I use the following parameter :<br> <br> =09 =09 <div> =09 <div dir=3D"ltr"> <pre dir=3D"ltr" style=3D"font-family:monospace"><code style=3D"font-fami= ly:monospace">-s 13,virtio-net,tap19 \</code></pre> </div> </div><br> /etc/rc.conf :<br> =09 =09 <div> =09 <div dir=3D"ltr"> <pre dir=3D"ltr" style=3D"font-family:monospace"><code style=3D"font-fami= ly:monospace">ifconfig_em0=3D"DHCP" local_unbound_enable=3D"YES" cloned_interfaces=3D"bridge0 tap0 tap1 tap2 tap3 tap4 tap5 tap6 tap7 t= ap8 tap9 tap10 tap11 tap12 tap13 tap14 tap15 tap16 tap17 tap18 tap19 tap20 = em0" ifconfig_bridge0=3D"addm em0 addm tap0 addm tap1 addm tap2 addm tap3 a= ddm tap4 addm tap5 addm tap6 addm tap7 addm tap8 addm tap9 addm tap10 addm = tap11 addm tap12 addm tap13 addm tap14 addm tap15 addm tap16 addm tap17 add= m tap18 addm tap19 addm tap20"</code></pre> </div> </div> <br> /boot/loader.conf<br> =09 =09 <div> =09 <div dir=3D"ltr"> <pre dir=3D"ltr" style=3D"font-family:monospace"><code style=3D"font-fami= ly:monospace">if_tap_load=3D"YES" if_bridge_load=3D"YES" bridgestp_load=3D"YES"</code></pre> </div> </div> <br> /etc/sysctl.conf<br> =09 =09 <div> =09 <div dir=3D"ltr"> <pre dir=3D"ltr" style=3D"font-family:monospace"><code style=3D"font-fami= ly:monospace">net.link.tap.up_on_open=3D1 net.inet.ip.forwarding=3D1 net.inet.ip.random_id=3D1</code></pre> </div> </div></div><div><br></div><div> So,ok. I think you have understood what I want to do. Please help me. Thank= s.</div></div><div dir=3D"ltr"><br><span class=3D"gmail_signature_prefix">-= - </span><br><div dir=3D"ltr" class=3D"gmail_signature">Mario<br></div></di= v> </blockquote></div></div> </blockquote></div><br clear=3D"all"><br><span class=3D"gmail_signature_pre= fix">-- </span><br><div dir=3D"ltr" class=3D"gmail_signature">Mario.<br></d= iv> </blockquote></div><br clear=3D"all"><br><span class=3D"gmail_signature_pre= fix">-- </span><br><div dir=3D"ltr" class=3D"gmail_signature">Mario.<br></d= iv> --0000000000003e57d40617afcd5a--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CA%2B1FSiitgGOF8_f4CZWHN2feW1fKBW263qo8KC6zWJ1%2BeAoiHA>