IP addresses/netmask screwed up

jndawson

Well-Known Member
Aug 27, 2014
289
31
78
Western US
cPanel Access Level
DataCenter Provider
We only had one (1) IP bound to eth0 so we wanted to add a /27 to one of our cPanel boxes and the tech typo'd the netmask and screwed things up. I got the IPs removed by removing them from /etc/ipaddrpool and /etc/ips (no help to the 'Show/Delete IP' screen since there was no way to actually remove them).

Ran 'service network restart' and 'service ipaliases restart'.

Now, when checking the IPs, the screen comes up blank, and when listing accounts, we get this:
Code:
Can't use an undefined value as a HASH reference at /usr/local/cpanel/Cpanel/NAT/Object.pm line 54.
 at /usr/local/cpanel/Cpanel/NAT/Object.pm line 54.
	Cpanel::NAT::Object::load_file(Cpanel::NAT::Object=HASH(0x51483f0)) called at /usr/local/cpanel/Cpanel/NAT/Object.pm line 27
	Cpanel::NAT::Object::new("Cpanel::NAT::Object") called at /usr/local/cpanel/Cpanel/NAT.pm line 20
	Cpanel::NAT::cpnat() called at /usr/local/cpanel/Cpanel/NAT.pm line 29
	Cpanel::NAT::get_public_ip("208.110.131.31") called at whostmgr/bin/whostmgr4.pl line 389
	main::listaccts() called at whostmgr/bin/whostmgr4.pl line 163
Obviously WHM is trying to call a file that doesn't fit with it's expected result. Rebooted and still nothing - same errors. 'Show IP Address Usage' shows nothing, 'Show/Edit Reserved IPs' shows this error:
Code:
undef error - Can't use an undefined value as a HASH reference at /usr/local/cpanel/Cpanel/NAT/Object.pm line 54.
/etc/ipaddrpool and /etc/ips are empty since neither contained our original single IP. Something went haywire - not sure where, or what to do. Tried rebooting; no difference. Websites work, mail flows.

Where to look? What to do?
 
Last edited:

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,910
2,213
363
Hello :)

Is this server setup on a NAT environment? If so, try running the following command and let us know if it helps:

Code:
/scripts/build_cpnat
Thank you.
 

jndawson

Well-Known Member
Aug 27, 2014
289
31
78
Western US
cPanel Access Level
DataCenter Provider
Hello :)

Is this server setup on a NAT environment? If so, try running the following command and let us know if it helps:

Code:
/scripts/build_cpnat
Thank you.
No, not a NAT environment, but ran the script anyway:

Code:
[ [email protected] system># /scripts/build_cpnat
info [build_cpnat] 208.110.131.31 => 208.110.131.31
info [build_cpnat] All publicly routeable addresses are the same as the local address. Not a NAT system.
Can't use an undefined value as a HASH reference at /usr/local/cpanel/Cpanel/NAT/Object.pm line 54.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,910
2,213
363
Does /var/cpanel/cpnat exist on your system? If so, and if you are not on a NAT environment, please delete this file and let us know if the issue persists.

Thank you.
 

jndawson

Well-Known Member
Aug 27, 2014
289
31
78
Western US
cPanel Access Level
DataCenter Provider
Does /var/cpanel/cpnat exist on your system? If so, and if you are not on a NAT environment, please delete this file and let us know if the issue persists.

Thank you.
That did it - thanks. I figured it would be something simple like that. Sure beats un-tarring the system backup directories to try to figure out what needs to be changed/removed. I'd suggest an easier method to roll back to previous configurations from system backups might be a good idea.
 
Jan 7, 2015
6
0
1
Copenhagen, Denmark, Denmark
cPanel Access Level
Root Administrator
I have the same issue, here is what I got
Code:
Can't use an undefined value as a HASH reference at /usr/local/cpanel/Cpanel/NAT/Object.pm line 54.
at /usr/local/cpanel/Cpanel/NAT/Object.pm line 54.
    Cpanel::NAT::Object::load_file(Cpanel::NAT::Object=HASH(0x5daa510)) called at /usr/local/cpanel/Cpanel/NAT/Object.pm line 27
    Cpanel::NAT::Object::new("Cpanel::NAT::Object") called at /usr/local/cpanel/Cpanel/NAT.pm line 20
    Cpanel::NAT::cpnat() called at /usr/local/cpanel/Cpanel/NAT.pm line 29
    Cpanel::NAT::get_public_ip("188.40.77.79") called at whostmgr
I also tried to restore from backup but I got the same error as below

Warning: The system failed to reinstall the MySQL database “default_freshout” as “default_freshout” because of an error: Failed to grant “default” access to “default_freshout”: Can't use an undefined value as a HASH reference at /usr/local/cpanel/Cpanel/NAT/Object.pm line 54.
I ran the code provided above but it did not solve the issue

I need help...
 
Jan 7, 2015
6
0
1
Copenhagen, Denmark, Denmark
cPanel Access Level
Root Administrator
Just a follow up, I ran /scripts/build-cpnat and this is what I got


[email protected] [~]# /scripts/build_cpnat
info [build_cpnat] 188.40.77.79 => 188.40.77.79
info [build_cpnat] All publicly routeable addresses are the same as the local address. Not a NAT system.
Can't use an undefined value as a HASH reference at /usr/local/cpanel/Cpanel/NAT/Object.pm line 54.
[email protected] [~]#[/CODE]

And the /var/cpanel/cpnat does not exist, I am not on NAT
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,910
2,213
363
Are you sure "/var/cpanel/cpnat" does not exist on this system? The error message you posted often occurs when this file exists on a system that does not utilize a NAT environment.

Thank you.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,910
2,213
363
Could you open a support ticket using the link in my signature so we can take a closer look? You can post the ticket number here so we can update this thread with the outcome.

Thank you.