Difference between revisions of "APC AP7900B"

From Alteeve Wiki
Jump to navigation Jump to search
(Created page with "{{howto_header}} This assumes you are on EL8 (CentOS Stream 8 or RHEL 8) with the Alteeve M3 Repo enabled. More specifically, this assumes that you have the <span class="code">screen</span> installed. = Serial Connection = The APC-brand AP7900B switched PDU is an excellent backup fence device. They are often used in pairs, one of each power rail, to provide a method of cutting power to both power supplies on Anvil! sub-nodes. We run t...")
 
(Redirected page to Configuring an APC AP7900)
Tag: New redirect
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
{{howto_header}}
#REDIRECT [[Configuring_an_APC_AP7900]]
 
This assumes you are on [[EL8]] (CentOS Stream 8 or RHEL 8) with the [[Alteeve M3 Repo]] enabled. More specifically, this assumes that you have the <span class="code">screen</span> installed.
 
= Serial Connection =
 
The APC-brand [[AP7900B]] switched [[PDU]] is an excellent backup [[fence device]]. They are often used in pairs, one of each power rail, to provide a method of cutting power to both [[power supplies]] on [[Anvil!]] [[sub-node]]s.
 
We run them on our [[VLAN]] isolated [[Back-Channel Network]], which has no access to the normal internal network, nor does it have access to the Internet. Thanks to this, we can safely run them without authentication over [[SNMP]] queries.
 
If you want to know more about the AP7900B than we cover here, you view view the entire manual at the link below:
 
* [https://www.apc.com/ca/en/product/AP7900B/rack-pdu-switched-1u-15a-100-120v-8515/ APC AP7900B Vendor Site]
 
{{warning|1=If you need to put the [[PDU]]s onto a public network, be sure to enable SNMP authentication!}}
 
= Serial Access =
 
[[image:Antaira_UTS-1110A_Top.jpg|thumb|right|400px|Antaira [https://www.antaira.com/products/USB-to-Serial/UTS-1110A UTS-1110A] single-port USB to RS-232] serial adapter. Photo by [http://shopping.netsuite.com/c.685553/site/images/Products/full/uts-1110a_1.jpg Antaira].]]
 
By default, the APC AP7900B does not have an IP address assigned.
 
We're going to use a program called <span class="code">[http://www.gnu.org/software/screen/ screen]</span> to talk to the PDU over the serial port.
 
{{note|1=The [[M3 Anvil!]] installs <span class="code">screen</span> on [[Striker]] dashboards, sub-nodes and [[DR host]]s.}}
 
To do this, you need to know what device the PDU's serial cable is plugged into. Some common ones:
 
{|class="wikitable"
!Type
!Device path
|-
|Serial port 1
|class="code"|/dev/ttyS0
|-
|Serial port 2
|class="code"|/dev/ttyS1
|-
|USB-Connected port 1
|class="code"|/dev/ttyUSB0
|-
|USB-Connected port 2
|class="code"|/dev/ttyUSB1
|}
 
... and so on.
 
In my case, I'm using the port on a USB to Serial adapter, so I will use '<span class="code">/dev/ttyUSB0</span>'.
 
Knowing this, we're ready to go!
 
Open a terminal window and run:
 
<syntaxhighlight lang="bash">
screen /dev/ttyUSB0
</syntaxhighlight>
 
{{note|1=When you are done, to exit <span class="code">screen</span>, press '<span class="code"><ctrl></span>' + '<span class="code">a</span>', release, then press '<span class="code">k</span>'. You will be prompted to kill the session, type '<span class="code">y</span>'.}}
 
The screen will be blank at first. Press '<span class="code"><enter></span>' a couple of times and the AP7900 login prompt should appear.
 
<syntaxhighlight lang="text">
User Name :   
</syntaxhighlight>
 
{{note|1=If you make a mistake and nothing happens when you press '<span class="code"><Backspace></span>', try pressing '<span class="code">ctrl</span>' + '<span class="code">h</span>' instead.}}
 
If you are asked to change the password, proceed under '[[#New Secured Firmware|New Secured Firmware]]'. If you see the status, proceed to '[[#Old Firmware|Old Firmware]]'
 
== New Secured Firmware ==
 
{{note|1=On newer devices, [[SNMP]], web access and so on is disabled by default. It is designed to make the PDU more secure, and so there is more work needed to make the switch work in an [[Anvil!]] cluster.}}
 
<syntaxhighlight lang="text">
The current password policy requires you to change your password...
</syntaxhighlight>
 
<syntaxhighlight lang="text">
Enter current password: ***
</syntaxhighlight>
 
<syntaxhighlight lang="text">
Enter new password: ***
Confirm new password: ***
</syntaxhighlight>
 
<syntaxhighlight lang="text">
Schneider Electric                      Network Management Card AOS      v6.9.6
(c) Copyright 2020 All Rights Reserved  RPDU 2g APP                      v6.9.6
-------------------------------------------------------------------------------
Name      : apc56BC4E                                Date : 05/18/2022
Contact  : Unknown                                  Time : 22:05:50
Location  : Unknown                                  User : Super User
Up Time  : 0 Days 1 Hour 39 Minutes                  Stat : P+ N4? N6+ A+
-------------------------------------------------------------------------------
IPv4              : Enabled            IPv6              : Enabled
Ping Response      : Enabled
-------------------------------------------------------------------------------
HTTP              : Disabled          HTTPS              : Enabled
FTP                : Disabled          Telnet            : Disabled
SSH/SCP            : Enabled            SNMPv1            : Disabled
SNMPv3            : Disabled
-------------------------------------------------------------------------------
Super User        : Enabled            RADIUS            : Disabled
Administrator      : Disabled          Device User        : Disabled
Read-Only User    : Disabled          Network-Only User  : Disabled
 
 
Type ? for command listing
Use tcpip command for IP address(-i), subnet(-s), and gateway(-g)
 
apc>
</syntaxhighlight>
 
=== Set the IP address ===
 
To set the IP, use the <span class="code">tcpip</span> command.
 
<syntaxhighlight lang="text">
apc>tcpip -i 10.201.2.1 -s 255.255.0.0
</syntaxhighlight>
<syntaxhighlight lang="text">
E002: Success
Reboot required for change to take effect.
</syntaxhighlight>
 
Reboot to have the IP take effect.
 
<syntaxhighlight lang="text">
apc>reboot -Y
</syntaxhighlight>
<syntaxhighlight lang="text">
E000: Success
Reboot Management Interface
Rebooting...
</syntaxhighlight>
 
=== Enable WebUI Access ===
 
After it reboots, log back in and then enable the web interface. To do this, we'll use the <span class="code">web</span> command to enable HTTP (<span class="code">-h</span>) and HTTP (<span class="code">-s</span>)
 
<syntaxhighlight lang="text">
apc>web -h enable
</syntaxhighlight>
<syntaxhighlight lang="text">
E002: Success
Reboot required for change to take effect.
 
 
* Reboot required for change to take effect.
</syntaxhighlight>
 
<syntaxhighlight lang="text">
apc>web -s enable 
</syntaxhighlight>
<syntaxhighlight lang="text">
E002: Success
Reboot required for change to take effect.
 
 
* Reboot required for change to take effect.
</syntaxhighlight>
 
Now reboot. When the NMC reboots, you can access the web interface.
 
=== Enable Use As Fence Device ===
 
{{warning|1=This configures the PDU for use as it was used in prior Anvil! systems. This is insecure, but acceptable as it's used on the isolated [[BCN]]. Consult the APC user manual and <span class="code">man fence_apc_snmp</span> for more secure configurations.}}
 
Enable SNMP v1, set the first community to <span class="code">private</span> and give the community <span class="code">write+</span> access. Then set the second community to <span class="code">public</span> and give the community <span class="code">write+</span> access.
 
<syntaxhighlight lang="text">
apc>snmp -S enable -c1 private -a1 writeplus
</syntaxhighlight>
<syntaxhighlight lang="text">
E000: Success
 
* Reboot required for change to take effect.
</syntaxhighlight>
 
<syntaxhighlight lang="text">
snmp -S enable -c2 public -a2 writeplus
</syntaxhighlight>
<syntaxhighlight lang="text">
E000: Success
</syntaxhighlight>
 
=== Reset To Factory Default ===
 
If you need to reset the PDU to factory defaults, you can do so with the <span class="code">resetToDef</span> command.
 
{{note|1=The example uses <span class="code">-p all</span> which resets everything. If you want to reset everything '''except''' the IP address, use <span class="code">-p keepip</span> instead.}}
 
<syntaxhighlight lang="text">
apc>resetToDef -p all
</syntaxhighlight>
 
<syntaxhighlight lang="text">
Reset to Defaults
</syntaxhighlight>
 
<syntaxhighlight lang="text">
Enter 'YES' to continue or <ENTER> to cancel : YES
</syntaxhighlight>
 
<syntaxhighlight lang="text">
Now initializing system to default values including
all User Names, Passwords and TCP/IP settings.
Please wait...
 
Please reboot system for changes to take effect!
 
 
* Reboot required for change to take effect.
</syntaxhighlight>
 
Now reboot to complete.
 
== Old Firmware ==
 
{{note|1=On older devices, SNMP, web access and so on is enabled by default.}}
 
On the older devices, after logging in, you will see a summary page.
 
<syntaxhighlight lang="text">
American Power Conversion              Network Management Card AOS      v3.7.4
(c) Copyright 2009 All Rights Reserved  Rack PDU APP                    v3.7.4
-------------------------------------------------------------------------------
Name      : RackPDU                                  Date : 05/23/2000
Contact  : Unknown                                  Time : 20:44:16
Location  : Unknown                                  User : Administrator
Up Time  : 3 Days 3 Hours 1 Minute                  Stat : P+ N? A+
 
Switched Rack PDU: Communication Established
 
------- Control Console -------------------------------------------------------
 
    1- Device Manager
    2- Network
    3- System
    4- Logout
 
    <ESC>- Main Menu, <ENTER>- Refresh, <CTRL-L>- Event Log
>
</syntaxhighlight>
 
Press '<span class="code">2</span>' to go into the "<span class="code">Network</span>" sub-menu.
 
<syntaxhighlight lang="text">
> 2
</syntaxhighlight>
<syntaxhighlight lang="text">
------- Network ---------------------------------------------------------------
 
    1- TCP/IP
    2- DNS
    3- Ping Utility
    4- FTP Server
    5- Telnet/SSH
    6- Web/SSL/TLS
    7- Email
    8- SNMP
    9- Syslog
    10- ISX Protocol
 
    <ESC>- Back, <ENTER>- Refresh, <CTRL-L>- Event Log
>
</syntaxhighlight>
 
Press the '<span class="code">1</span>' key to go into the "<span class="code">TCP/IP</span>" menu.
 
<syntaxhighlight lang="text">
> 1
</syntaxhighlight>
<syntaxhighlight lang="text">
------- TCP/IP ----------------------------------------------------------------
 
        Network not started. Currently making a BOOTP request...
        -----------------------------------------------------------------------
        MAC Address : 00 C0 B7 88 CC 1E
 
    1- Boot Mode  : DHCP & BOOTP
    2- Advanced...
 
    <ESC>- Back, <ENTER>- Refresh, <CTRL-L>- Event Log
>
</syntaxhighlight>
 
First we need to change the "<span class="code">Boot Mode</span>" to "<span class="code">Manual</span>", so press '<span class="code">1</span>'.
 
<syntaxhighlight lang="text">
> 1
</syntaxhighlight>
<syntaxhighlight lang="text">
------- Boot Mode -------------------------------------------------------------
 
    1- DHCP & BOOTP
    2- DHCP only
    3- BOOTP only
    4- Manual
 
    <ESC>- Back, <ENTER>- Refresh
</syntaxhighlight>
 
Press '<span class="code">4</span>' to select the "<span class="code">Manual</span>" option.
 
<syntaxhighlight lang="text">
> 4
</syntaxhighlight>
<syntaxhighlight lang="text">
------- TCP/IP ----------------------------------------------------------------
 
        Network not started. Currently making a BOOTP request...
        -----------------------------------------------------------------------
        MAC Address : 00 C0 B7 88 CC 1E
 
        * Changes will take effect on logout.
 
    1- System IP      : 0.0.0.0
    2- Subnet Mask    : 0.0.0.0
    3- Default Gateway: 0.0.0.0
    4- Boot Mode      : Manual
    5- Advanced...
 
    <ESC>- Back, <ENTER>- Refresh, <CTRL-L>- Event Log
>
</syntaxhighlight>
 
Now we're ready to set the IP address.
 
In [[AN!Cluster_Tutorial_2#Subnets|most ''Anvil!'' systems]], the switched PDUs have the IP address of '<span class="code">10.201.2.x/255.255.0.0</span>'.
 
This is the convention we're going to use here. This is our first PDU, so we'll set:
 
{|class="wikitable"
|-
|class="code"|System IP
|class="code"|10.201.2.1
|-
|class="code"|Subnet Mask
|class="code"|255.255.0.0
|-
|class="code"|Default Gateway
|class="code"|10.201.255.254
|}
 
There is no outside network access on the [[Back-Channel Network]], so it may not seem like it makes sense to set the "<span class="code">Default Gateway</span>". The problem is that the PDU requires a gateway be set, so we give it a fake, unused address. Often, when there is a router on a network, it takes the top of bottom IP address in the subnet. We're using the top IP address as the dummy gateway here.
 
So back to it!
 
Press '<span class="code">1</span>' to set the IP.
 
<syntaxhighlight lang="text">
> 1
</syntaxhighlight>
<syntaxhighlight lang="text">
System IP : 10.201.2.1
</syntaxhighlight>
<syntaxhighlight lang="text">
------- TCP/IP ----------------------------------------------------------------
 
        Network not started. IP, Subnet, Gateway must be configured.
        -----------------------------------------------------------------------
        MAC Address : 00 C0 B7 88 CC 1E
 
        * Changes will take effect on logout.
 
    1- System IP      : 10.201.2.1
    2- Subnet Mask    : 0.0.0.0
    3- Default Gateway: 0.0.0.0
    4- Boot Mode      : Manual
    5- Advanced...
 
    <ESC>- Back, <ENTER>- Refresh, <CTRL-L>- Event Log
>
</syntaxhighlight>
 
Now press '<span class="code">2</span>' to set the "<span class="code">Subnet Mask</span>".
 
<syntaxhighlight lang="text">
> 2
</syntaxhighlight>
<syntaxhighlight lang="text">
Subnet Mask : 255.255.0.0
</syntaxhighlight>
<syntaxhighlight lang="text">
------- TCP/IP ----------------------------------------------------------------
 
        Network not started. IP, Subnet, Gateway must be configured.
        -----------------------------------------------------------------------
        MAC Address : 00 C0 B7 88 CC 1E
 
        * Changes will take effect on logout.
 
    1- System IP      : 10.201.2.1
    2- Subnet Mask    : 255.255.0.0
    3- Default Gateway: 0.0.0.0
    4- Boot Mode      : Manual
    5- Advanced...
 
    <ESC>- Back, <ENTER>- Refresh, <CTRL-L>- Event Log
>
</syntaxhighlight>
 
Now press '<span class="code">3</span>' to set the dummy "<span class="code">Default Gateway</span>" address.
 
<syntaxhighlight lang="text">
> 3
</syntaxhighlight>
<syntaxhighlight lang="text">
Default Gateway : 10.201.255.254
 
------- TCP/IP ----------------------------------------------------------------
 
        Network not started. Currently making a DHCP request...
        -----------------------------------------------------------------------
        MAC Address : 00 C0 B7 88 CC 1E
 
        * A cookie is required in the vendor options to accept a DHCP offer.
        * Changes will take effect on logout.
 
    1- System IP      : 10.201.2.1
    2- Subnet Mask    : 255.255.0.0
    3- Default Gateway: 10.201.255.254
    4- Boot Mode      : Manual
    5- Advanced...
 
    <ESC>- Back, <ENTER>- Refresh, <CTRL-L>- Event Log
>
</syntaxhighlight>
 
{{note|1=The changes won't take effect until we log out.}}
 
Press '<span class="code"><esc></span>' to go back to the main menu.
 
<syntaxhighlight lang="text">
<esc>
</syntaxhighlight>
<syntaxhighlight lang="text">
------- Network ---------------------------------------------------------------
 
    1- TCP/IP
    2- DNS
    3- Ping Utility
    4- FTP Server
    5- Telnet/SSH
    6- Web/SSL/TLS
    7- Email
    8- SNMP
    9- Syslog
    10- ISX Protocol
 
    <ESC>- Back, <ENTER>- Refresh, <CTRL-L>- Event Log
</syntaxhighlight>
 
Press '<span class="code"><esc></span>' again.
 
<syntaxhighlight lang="text">
<esc>
</syntaxhighlight>
<syntaxhighlight lang="text">
------- Control Console -------------------------------------------------------
 
    1- Device Manager
    2- Network
    3- System
    4- Logout
 
    <ESC>- Main Menu, <ENTER>- Refresh, <CTRL-L>- Event Log
>
</syntaxhighlight>
 
Lastly, press '<span class="code">4</span>' to log out.
 
<syntaxhighlight lang="text">
> 4
</syntaxhighlight>
<syntaxhighlight lang="text">
Logging out.
</syntaxhighlight>
 
The terminal window will no longer respond (the PDU is rebooting).
 
To exit out of '<span class="code">screen</span>', you need to press '<span class="code">ctrl</span> + <span class="code">a</span>', release the keys, then press '<span class="code">k</span>'.
 
<syntaxhighlight lang="text">
<ctrl> + <a>
</syntaxhighlight>
 
(release)
 
<syntaxhighlight lang="text">
<k>
</syntaxhighlight>
 
Screen will ask if you want to kill the session.
 
<syntaxhighlight lang="text">
Really kill this window [y/n]
</syntaxhighlight>
 
Press '<span class="code">y</span>'
 
<syntaxhighlight lang="text">
y
</syntaxhighlight>
<syntaxhighlight lang="text">
[screen is terminating]
</syntaxhighlight>
 
Now you are back at the normal linux terminal.
 
{{note|1=Please be patient while the PDU reboots. It might take a minute.}}
 
You can test the connection to the PDU using '<span class="code">ping</span>';
 
<syntaxhighlight lang="bash">
ping -c 3 10.201.2.1
</syntaxhighlight>
<syntaxhighlight lang="text">
PING 10.201.2.1 (10.201.2.1) 56(84) bytes of data.
64 bytes from 10.201.2.1: icmp_seq=1 ttl=255 time=4.61 ms
64 bytes from 10.201.2.1: icmp_seq=2 ttl=255 time=4.30 ms
64 bytes from 10.201.2.1: icmp_seq=3 ttl=255 time=3.00 ms
 
--- 10.201.2.1 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2006ms
rtt min/avg/max/mdev = 3.006/3.976/4.613/0.697 ms
</syntaxhighlight>
 
Done!
 
= Recipe =
 
If you know what you're doing, and you want a quick copy-paste configuration for the new firmware, edit the IP to be what you want and then paste this.
 
{{note|1=Make sure you change <span class="code">.x<span> to the IP address you want!}}
 
<syntaxhighlight lang="text">
tcpip -i 10.201.2.x -s 255.255.0.0
web -h enable
web -s enable
snmp -S enable -c1 private -a1 writeplus
snmp -S enable -c2 public -a2 writeplus
reboot -Y
</syntaxhighlight>
 
{{footer}}

Latest revision as of 19:02, 15 August 2023