How Do You Display the VPC Peering Connections with Boto3?

Problem scenario
You want to list all the VPC Peering Connections for a specific region using Python.

You want the equivalent of aws ec2 describe-vpc-peering-connections

How do you show (retrieve or fetch) the VPC peering connections using Boto3?

Solution

import boto3
contint = boto3.client(‘ec2’)
var1 = contint.describe_vpc_peering_connections()
print(var1) …

How Do You Troubleshoot the nmap Results “Host seems down” when the Other Server is Not Down?

Problem scenario
Two servers have a specific incoming port open between them. But when you try nmap to test the port, you get a message like this:

Starting Nmap 7.60 ( https://nmap.org ) at 2019-10-08 19:57 UTC
Note: Host seems down. If it is really up, but blocking our ping probes, try -Pn
Nmap done: 1 IP address (0 hosts up) scanned in 3.04 seconds

What should you do?

How Do You Get Past “ImportError: No module named ‘boto'”?

Problem scenario
You want to retrieve VPC peering connection info and other VPC info via Boto3. With Python 3 you tried to run this Python 2 (and Boto 2.x) program:

import boto.vpc
c = boto.vpc.connect_to_region(‘us-east-1’)
vpcs = c.get_all_vpcs()
vpc_peering_connection = c.create_vpc_peering_connection(vpcs[0].id, vpcs[1].id)

(It was written by the person who developed Boto 2.x here.)

You have a variety or problems with the syntax not working.

How Do You Configure the Wireless Security Camera with a TCP/IP Network?

Problem scenario
You have a camera (e.g., a TCP/IP ADT security camera) attached to your a router on the network with your laptop. You know the camera’s MAC address by looking at the back of the camera itself (or you know its IP address on your network which is even more helpful). How do you use this camera over the network?

Solution
1.

How Do You Troubleshoot This Error “port bindings are not yet supported by rootless containers”?

Problem scenario
You run a docker command, but you get “port bindings are not yet supported by rootless containers”. What should you do?

Solution
Use sudo before the Docker command.

Waning: The above is not recommend for security purposes. Only follow this direction (with sudo docker run…), if the server is not that important or you are in a very secure network.

How Do You Troubleshoot Puppet Agent with a “Failed to open TCP connection…connection refused port 8140” error?

Problem scenario
You run puppet agent but you get this error:

Error: Could not request certificate: Failed to open TCP connection to puppetmaster.domain.com:8140 (Connection refused – connect(2) for “puppetmaster.domain.com” port 8140)

What do you do?

Solution
Ensure port 8140 is open. Install nmap on a server, and run this command:

nmap -p 8140 puppetmaster.domain.com

If you see this

PORT STATE SERVICE
8140/tcp closed unknown

Then the Puppet Master service is not running.

How Do You Configure Linux CentOS 6.x to Accept SSH Connections?

Problem scenario
You try to use PuTTY to connect to a Linux CentOS 6.x server. You get the message “Network error: Connection refused.” What should you do?

Solution
Prerequisite
This assumes that there is no software or hardware firewall blocking port 22. You may want to use nmap or a Windows PowerShell port tester to verify port 22 is open.

Why Cannot You Ping an IP Address of an AWS Server when the Security Group Should Allow for Pinging?

Problem scenario
In AWS you manually added a Security Group rule for the source of a given IP address. This IP address is either the internal or external IP address. You can ping one of them (either the internal or external IP address). Why cannot you ping each IP address?

Solution
Check to see if a firewall is running on the Linux server.

What Should You Do when the Apache Mesos Web UI Keeps Refreshing and Sending a Pop-up “Failed to connect to …:5050”?

Problem scenario
You deployed Apache Mesos. The web UI is having problems. You see the error “Failed to connect to x.x.x.x:5050.” What should you do?

Solution

  1. Go to the back-end of the Apache Mesos server. Run this command: sudo systemctl stop mesos-master
  2. sudo find / -name mesos-master.sh
  3. Change directory into the parent of the “bin” directory that houses the mesos-master.sh as found above.

When Does the DNS Server Override the /etc/hosts File for FQDN or Domain Name Resolution?

Problem scenario
You notice that on some Linux servers the /etc/hosts file controls the resolution of hostnames and on other servers the DNS server overrides the /etc/hosts file. Which has precedence in DNS resolution, /etc/hosts or the DNS server on the network?

Answer
It depends. The /etc/nsswitch.conf file will decide. There is a “hosts” stanza. This setting will have the DNS server override the /etc/hosts file:

hosts:dns files

This setting will have the /etc/hosts file take precedence for name resolution:

hosts:files dns

To get the hostname,