1

I have a single static public IPv4 address from my ISP.

So I understand that i can just forward all traffic using port forwarding to one of my private IPs, but still I am wondering if this is the right way to go about it, especially because i am planning on getting a few more ipv4 addresses.

I could then use NAT, but I dont really have any need to have multiple hosts sharing a single public IP.

So my questions are the following:

  1. Can i assign the public IP to one of my hosts directly, instead of the router i mean? The router gets its IP via dhcp, but i have the option to set that to static, what then should i put as the WAN address of the router? or is that the wrong way to go about it

  2. If i have multiple public IPs do I need to use NAT? If not roughly what kinds of network configuration do i have to do in my router (static routes, access rules etc?)

Thanks in advance

EDIT: I am using the Cisco RV160W

4
  • The answer to both your questions are yes, depending on what you're trying to do. Can you explain more about why you want to assign IPs to your hosts? You can assign them private IPs, and set your NAT you use multiple publics for them.
    – Ron Trunk
    Commented Sep 16, 2020 at 17:49
  • I am building my own kubernetes cluster, using floating ips to get traffic into it. IPv6 it works great, i got my delegated prefix and can just assign them in my keepalived configuration. now when doing it in ipv4 and using nat, i have this seemingly unnessecary step of either using port forwarding or nat. i would rather have my router not having a public ip at all and just using it for my cluster
    – Tobias
    Commented Sep 16, 2020 at 17:53
  • how would i go about configuring my ipv4 wan? to prevent my router from taking the one public ip i have to disable dhcp, but when i chose a random static ip and gateway i cant connect to the internet anymore.
    – Tobias
    Commented Sep 16, 2020 at 17:56
  • Your ISP will assign you a static address - you can't just pick one.
    – Ron Trunk
    Commented Sep 16, 2020 at 18:18

2 Answers 2

1

You can ask your ISP for a block of IPv4 addresses that is separate from your connection to your ISP (similar to your IPv6 block). In that case, you would create a new VLAN on your router and assign it the new public subnet. You can put as many hosts in that subnet as you have IPs (minus one for the gateway).

Since this subnet is connected your router, you can still use your firewall to protect your new public hosts.

1
  • that answers and you comments answer it perfectly. Thank you very much! Incase you are ever looking for a highly driven youngster with a extraordinary work morale send me a message at [email protected].
    – Tobias
    Commented Sep 16, 2020 at 18:57
1

Can i assign the public IP to one of my hosts directly, instead of the router i mean?

With a single IP address you can only have a single device connected to WAN - either the router or the host. The router can port forward/reverse NAT/destination NAT selected ports to private IP hosts, but with the host that's not possible (unless you can use it as a NAT router as well).

Connecting a host directly to the Internet has the added disadvantage of not having a firewall in between, which is best practice.

Also, you should use two NICs in the host, one for LAN, one for WAN, to be clean.

So, connect the router, not the host, and forward public ports to the host.

Even when you get multiple IP addresses you should have a firewall in between the Internet and your hosts. Using IPv4, destination NAT is the standard solution when all your public IP addresses belong to one network (ie. the ISP simply puts their packets on the wire). Routing public addresses requires at least one address for the router in addition to your separate public subnet.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.