starting a machine in Docker with ports

docker run -p 800:80 -p 2222:22 -p  4443:443  -it 68715929d32a  /bin/bash

If ports do not work check :

sysctl net.ipv4.ip_forward

if  you get:

net.ipv4.ip_forward = 0

then issue :

sysctl -w net.ipv4.ip_forward=1
net.ipv4.ip_forward = 1if you get the error :
 
docker: Error response from daemon: driver failed programming external connectivity on endpoint amazing_williams (44e256a6039741b20e4124800702d9794d69fb6be9da71ba25059de4dd527121): COMMAND_FAILED: '/sbin/iptables -w2 -t nat -A DOCKER -p tcp -d 0/0 --dport 4443 -j DNAT --to-destination 172.17.0.2:443 ! -i docker0' failed: iptables: <strong>No chain/target/match by that name..</strong>

 

systemctl stop firewalld
systemctl mask firewalld
Created symlink from /etc/systemd/system/firewalld.service to /dev/null.
yum install iptables-services
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.euserv.net
* epel: fr.mirror.babylon.network
* extras: ftp.fau.de
* updates: centos.fastbull.org
Resolving Dependencies
--> Running transaction check
---> Package iptables-services.x86_64 0:1.4.21-16.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================================================================================================================================
Package Arch Version Repository Size
=============================================================================================================================================================================================================================================
Installing:
iptables-services x86_64 1.4.21-16.el7 base 50 k

Transaction Summary
=============================================================================================================================================================================================================================================
Install 1 Package

Total download size: 50 k
Installed size: 24 k
Is this ok [y/d/N]: y
Downloading packages:
iptables-services-1.4.21-16.el7.x86_64.rpm | 50 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : iptables-services-1.4.21-16.el7.x86_64 1/1
Verifying : iptables-services-1.4.21-16.el7.x86_64 1/1

Installed:
iptables-services.x86_64 0:1.4.21-16.el7

Complete!
systemctl enable iptables
Created symlink from /etc/systemd/system/basic.target.wants/iptables.service to /usr/lib/systemd/system/iptables.service.
service iptables save
iptables: Saving firewall rules to /etc/sysconfig/iptables:[ OK ]

try :

docker run -p 800:80 -p 2222:22 -p 4443:443 -it 68715929d32a /bin/bash

Querying network card information and status

Great tool for checking ethernet NIC information in linux:

ethtool

In ubuntu you might need to install it like so :

sudo apt-get install ethtool

The tool is easy to use:

 

Use

ifconfig -a 

to list nics

then

 

root@wo1:~# ethtool p4p1
Settings for p4p1:
Supported ports: [ TP ]
           Supported link modes: 10baseT/Half 10baseT/Full
                                            100baseT/Half 100baseT/Full
                                            1000baseT/Full
Supported pause frame use: No
Supports auto-negotiation: Yes
Advertised link modes:            10baseT/Half 10baseT/Full
                                            100baseT/Half 100baseT/Full
                                            1000baseT/Full
Advertised pause frame use: Symmetric
Advertised auto-negotiation: Yes
Speed: 1000Mb/s
Duplex: Full
Port: Twisted Pair
PHYAD: 1
Transceiver: internal
Auto-negotiation: on
MDI-X: Unknown
Supports Wake-on: pumbg
Wake-on: g
Current message level: 0x00000007 (7)
                                    drv probe link
Link detected: yes
root@wo1:~#

 

nJoy 😉

Troubleshooting network connection failures VMWare Workstation

Symptoms

You are experiencing these issues:

  • No network connectivity for a virtual machine
  • Cannot connect to the Internet from the guest operating system
  • Bridged, Host-only or Network Address Translation (NAT) networking fails

Purpose

This article helps you to determine the cause of networking problems affecting one or more virtual machines. The steps in this article address whether the networking has been misconfigured on the host operating system, guest operating system or virtual machine.

Resolution

(more…)