Router: Motorola NVG510
Okay well since my router is junk, I did find a more simple work around other then what other people have proposed. Its working on my network with my OpenVZ Node and the VPS containers on the node. Note: Openvz venet will not work properly for the portforwarding, but venet device will work find behind the router (local network)
Since my router has somekind of caching system which I'm going to assume it binds the dhcp address by mac/dhcp_hostname so I basically configured my ifcfg-eth0 to use dhcp
Code:
DEVICE=eth0
ONBOOT=yes
TYPE=Ethernet
BOOTPROTO=dhcp
HOSTNAME=oknode.xxx.org
DHCP_HOSTNAME=oknode
HWADDR=00:17:31:88:53:0B
Now once my server requested the IP server which is pulls 192.168.1.64.
This is how its displayed in my network device list on my router Device > Device List
Code:
Device IPv4 Address / Name MAC Address Status Connection Allocation
192.168.1.64 / oknode 00:17:31:88:53:0b on Ethernet dhcp
my centos machine now existed in the device list in my NAT Portforward in the Router GUI.
So Now that information is cached in the router I changed it back to static IP like this
Code:
DEVICE=eth0
ONBOOT=yes
TYPE=Ethernet
BOOTPROTO=none
HWADDR=00:17:31:88:53:0B
HOSTNAME=oknode.xxx.org
NETMASK=255.255.255.0
IPADDR=192.168.1.101
GATEWAY=192.168.1.254
My router now sees my static IP and it keeps the device name oknode. Basically it looks like this in my router Device List
Code:
Device IPv4 Address / Name MAC Address Status Connection Allocation
192.168.1.101 / oknode 00:17:31:88:53:0b on Ethernet static
So at this point I think its safe to say its updated like it should.
Now in my router GUI I can go to my firewall > NAT/Gaming > select my services I want to port forward and my device name can be selected from the device list.
Now for some addition info for the work around for the openvz containers thats on my server. You have to use veth and not venet network devices, basically you have to bridge your network device such as this
Code:
# vi /etc/sysconfig/network-scripts/ifcfg-vmbr0
DEVICE="vmbr0"
BOOTPROTO="static"
IPV6INIT="no"
ONBOOT="yes"
TYPE="Bridge"
DELAY=0
IPADDR=192.168.1.101
NETMASK=255.255.255.0
GATEWAY=192.168.1.254
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
ONBOOT="yes"
IPV6INIT="no"
TYPE="Ethernet"
BRIDGE="vmbr0"
OpenVZ has a script you need to add to automate the veth devices.
# vi /etc/vz/vznet.conf
Quote:
#!/bin/bash
EXTERNAL_SCRIPT="/usr/sbin/vznetaddbr"
|
Stop your openvz container and add the veth device to openvz container
# vzctl set <CID> --netif_add eth0 --save
Now edit your container/VE/VPS network scripts
# vi /vz/root/102/etc/sysconfig/network-scripts/ifcfg-eth0
Quote:
DEVICE="eth0"
HOSTNAME="vps1"
MTU="1500"
TYPE="Ethernet"
ONBOOT=yes
BOOTPROTO=dhcp
DHCP_HOSTNAME=vps1
|
Now this will populate and pull from the router and bind the mac of the veth device and it will cache in the router.
Now go back and change it to static
# vi /vz/root/102/etc/sysconfig/network-scripts/ifcfg-eth0
Quote:
DEVICE="eth0"
HOSTNAME="vps"
TYPE="Ethernet"
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.1.102
NETMASK=255.255.255.0
GATEWAY=192.168.1.254
|
Now again successfully the router device populates in the list under the router firewall>NAT/Gaming and you can select the device and open the ports needed.
Most of this information is not in a manual or anywhere on the web to make a server work with static ips with port forward with this modem/router so I hope this work around will help somebody.