How to enable ethernet connection in CLI? - console

My last update on Fedora 22 Workstation simply broke my OS, it won't log in, crashing before it.
I want to download and install some new files to fix it. I'm plugging ethernet cable, but I can't connect to Internet.
In Gnome it's like wifi, just clicking on Enable or something like that
How can I enable ethernet connection in CLI mode (ctrl+alt+f2)?

The up flag with interface name (eth0) enables a network interface. For example, the following command will activates the eth0 network interface.
sudo ip link set eth0 up

Related

Connect with SSH to a Cisco Switch through a Cisco Router

Trying to ssh a switch from Putty through a Router that works when doing if I connect first to the router via console cable and when there I SSH the switch then it works but when trying to do it from putty it says Network error: connection timeout
I just found the solutions. In windows Just went to the Inbounds rule for in Windows Defender Firewall with Advanced Security and then set inbounds and outbounds rules allowing TCP port and another rule for Allowing another subnet witch the one you want to SSH.
On Mac Using terminal type sudo nano /etc/ssh/ssh_config then Un-comment the line: Ciphers aes128-ctr,aes192-ctr,aes256-ctr,aes128-cbc,3des-cbc
Press Ctrl + X. Press Enter to save and exit.

Can not SSH or PING RasPi3B+ IP address

I have a Raspberry Pi 3B+ which I have to admit has only recently shown this problem.
I booted up the Pi normally and tried to SSH into it since I have a static IP set for it. This was unsuccesful, so I connected my monitor and keyboard, and run ifconfig to see the current IP address. After checking to see if my laptop is connected to the same WiFi network as the Pi, I tried SSH-ing into the Pi with no success: sh: connect to host xxx.xxx.xxx.xxx port 22: Connection timed out or Reply from xxx.xxx.xxx.xxx: Destination host unreachable..
My Pi has the SSH interface option enabled and can use it's internet connectivity as I could PING www.google.com with success and can also run sudo apt update && sudo apt upgrade.
I tried rebooting thinking this is a power issue, using a different socket / charger, restarting dhcpcd.service. No success, so I got curious.
I have connected a WiFi dongle onto the Pi, enabling the wlan1 interface which immediately discovered and connected to the WiFi network (it is an open network) and was assigned an IP. SSH=ing into this IP was successful. How can I fix my wlan0 interface? I do not want to rely on an external dongle. Connecting an ethernet cable and SSH-ing using the eth0 interface works as well.
I ended up reflashing my RaspberryPi with a fresh install

vmware bridged mode and NAT is not connecting

I've tried every adapter settings to be able connect internet through VM, but VM seems it can't connect in bridged mode and also NAT mode.
I tried to run couple of commands such as
service networking down
service networking start
ifconfig eth0 down
ifconfig eth0 up
None of them seems working.
Please tell me what I should do
Thanks
You might delete or disable one of VMware services. You can open services.msc via Run to search vmware services.
Please go Edit > Virtual Network Editor on your VMware
You need to get administrator previleges to Restore Defaults first
click on Change Settings button.
Click on Restore Defaults and wait for it finish

Emulator networking ip address and virtual router

I am using android emulator on windows. The android developer doc says that each instance of the emulator runs behind a virtual router/firewall service. The virtual router for each instance manages the 10.0.2/24 network address space . However, when I connect to the emulator with adb shell and do ifconfig, I got the following output:
radio0 Link encap:UNSPEC
inet addr:192.168.200.2 Bcast:192.168.200.255 Mask:255.255.255.0
wlan0 Link encap:UNSPEC
inet addr:192.168.232.2 Bcast:192.168.239.255 Mask:255.255.248.0
ip route show gives me the following output
192.168.200.0/24 dev radio0 proto kernel scope link src 192.168.200.2
192.168.232.0/21 dev wlan0 proto kernel scope link src 192.168.232.2
I do not see any of the 10.2.x.x ip address. Where are those ip address?
Also does the virtual router run within the emulator (on the Android OS) or run on windows? How to exam the virtual router?
I have the same issue running Android 7.1.1 (API 25) on Windows.
But when I emulating Android 7.0 (API 24) it works as expected. Device gets IP 10.0.2.15. In this case ip route show will bring 10.2.x.x address. So, if you can just use prior versions (API 16 - API 24).
This router exists inside emulator and Windows is not aware about it.
If you need to access service running inside emulator from Windows, you need to add port mappings:
telnet localhost 5554
auth <token from 'C:\Users\{user}\.emulator_console_auth_token'>
redir add tcp:8080:8080
Then you can access your service by: 127.0.0.1:8080. However, this approach does not work with Android 7.1.1. I have no ideas what is wrong with it.
It appears that since API 25, the networking of an emulator has changed. The device IP is no longer 10.0.2.15, and issuing a 'redir' command via telnet, as it is documented, no longer work.
In order to have a redirection, use the adb program. First, make sure adb is in your earch path. Typically, it is under Android/Sdk/platform-tools, wherever the Android SDK is located, whatever OS you are using.
Then, use the following command line:
adb forward tcp:<host port> tcp:<guest port>
(For example: adb forward tcp:8080 tcp:8080). Now, you can access port with: telnet localhost <host port>, which will be redirected to the guest.
This is very unfortunate, because (as of build 28) it isn't documented this way. I assume at some point documentation will be fixed.
Actually it depends. I've connected to and tested my SFTP Server app on an "Android 11 API 30 Emulator" and on an "Android TV 9 API 28 Emulator".
On the "Android 11 API 30 Emulator" my SFTP Server app showed up listening on IP 10.0.2.16 and port 6789 and I could connect to it using redir add tcp:<localhost-port>:6789 (further details see Setting up redirection through the Emulator Console). BUT I could as well connect to it using adb -s <emulator-id> forward tcp:<localhost-port> tcp:6789.
On the "Android TV 9 API 28 Emulator" my SFTP Server app showed up listening on IP 192.168.232.2 and port 6789 and I could ONLY connect to it using adb -s <emulator-id> forward tcp:<localhost-port> tcp:6789. I could NOT connect to it using redir add tcp:<localhost-port>:6789.
Conclusion "adb forward" is always working and therefore should be used. (Do not use "redir add tcp" that only sometimes works in the address range 10.0.2.0/24).

Share the internet access from laptop to beaglebone black and then access it through VNC server

I am trying to share the internet with the Beaglebone Black from my laptop. Here is what I tried till now-
I connected Beaglebone Black to my laptop running Windows 8 via USB cable. Then, I went to network and sharing center. Then, the network which I want to share, I shared it with the Beaglebone(It says Local Area Connection). Now, I went to the Gate one SSH on Beaglebone and wrote - "ping www.google.com". But it said "Unknown Host".
Now, since the above didn't work, I connected the Beaglebone Black with the standard ethernet cable and again tried sharing my network, but it still didn't work.
Here is what I am trying to do-
If I am able to connect to internet, I want to set up VNC server and through that I want to load the GUI of linux on my laptop.
Any help will be greatly appreciated. If there is any other method to accomplish this, please tell me about it. I have tried most of the tutorials on the internet, but didn't succeed.
Here is the detailed answer, after long long waiting I finally figured out how to share internet on BBB. This question is being seen at least 10 times everyday so I though I should answer it by my own. (Also SO gave me Popular question badge for this!)
First thing I tried was:
I connected the BBB(running angstrom) to laptop (running windows 8). The laptop recognized the device and I was able to SSH it through putty.
Now, I tried to ping my computer back whose IP address is 192.168.7.1 .. This step never worked for me, my BBB was never able to ping my computer back but, I was able to ping the beaglebone itself through the provided IP that is 192.168.7.2 (which is obvious)
I searched everywhere on internet and did everything to overcome this glitch such as:
I made the default gateway in BBB to 192.168.7.1
/sbin/route add default gw 192.168.7.1
but that also didn't worked.
I previously thought that it is necessary for me to ping 192.168.7.1 in order to get the internet on BBB.
Since nothing was working I decided to skip this step.
I simply connected the BBB, and then went to network and sharing center in windows 8 and from there, I shared the internet connection from my wifi connection to the beaglebone.
As you will do this, you will see that BB will loose its connection from the putty (if you started putty before network sharing), This is because computer assigns an IP to the BB which you have to change to 'Obtain the IP automatially'
To do this right click and go to properties of the BB connection and then from the list select the IPV4 tcp/IP and go to its properties. In that, you will see the option 'Obtain IP automatically'
Now again start putty (as previous connection will get terminated) and you will see that BB is able to connect.
Now simply add the default gateway as I showed above and then you will be able to ping 8.8.8.8 or any other IP address. Now, simply add the nameserver like this:
cd /etc
more resolv.conf
nano resolv.conf
and add this line below nameserver 127.0.0.1
nameserver 8.8.8.8
and save it, you will be able to ping google.com.
Now comes the VNC server part. For that case also I was wrong. To connect to VNC server you do not need internet connection on the BBB. Yes, you will need that for installing the VNC server on it but not afterwards. Once it is installed, you have to simple do this in BB:
x11vnc -bg -o %HOME/.x11vnc.log.%VNCDISPLAY -auth /var/run/gdm/auth-for-gdm*/database -display :0 -forever
and press enter and BB will reply with VNC started at port 5900
Thats it, now comeback to windows and start VNC server, add the address 192.168.7.2 and you can see the GUI on the screen. I am also able surf internet on the beaglebone.
Thank you for the support and if I am wrong here in my question then please notify me.
Also if you have any doubt, refer to this awesome video my derek molloy: He has explained it very well and remember to skip the step of pinging back 192.168.7.1 if it is not working.
I have not yet figured it out. I will edit the answer once I get it.
1) On your Beaglebone:
sudo su
ifconfig usb0 192.168.7.2
route add default gw 192.168.7.1
2) Now share the network and make sure your pc's ip is 192.168.7.1 after you do
connect beaglebone black to router via ethernet
now use
adb tcpip 5555
adb connect bbb_ip:5555 then use adb shell
The problem you're facing is of resolving nameservers. If you're able to access the device through SSH (using PuTTy, for example), then you can provide it internet too- but the device needs to know where to look for.
The BeagleBone Black has a utility called Connman that manages its connections.
/usr/lib/connman/test has functions related to it.
Use ./set-ipv4-method in there to set different values. Be sure to set the nameservers right. If in doubt, use 8.8.8.8 as the only entry. Also note that the gateway for your BeagleBone must be your computer.
If you're not a newbie and need more detailed instructions, see this.
To continue from the answer provide by Vikas Arora, 3 things you have to do primarily to provide ethernet over usb connection to your Beaglebone. Firstly, share your PC internet connection with the local network made with Beaglebone, a process well explained above. And also setting up the IP address to be obtained automatically.
Secondly, setting up the nameserver to the public DNS server address 8.8.8.8 also explained above. But this setting is not persistent i.e. once you reboot, the settings will be lost. It is because the network manager on Angstrom 'connman' resets the etc/resolv.conf on startup. To correct that I disabled the connman service on my device by going to /lib/systemd/system and
firing commands
systemctl stop connman.service
systemctl disable connman.service
This will make your nameserver file persistent and you can always start connman service again if you need.
Thirdly you have to set your gateway to the address of your internet sharing machine also explained above. But this setting is also not persistent. To do that make a script like below in your home directory
echo "********Setting up the default gateway"
route add default gw 192.168.7.1
and make a service that will kick off on startup and trigger your script. A process well explained at
https://askubuntu.com/questions/506167/how-do-you-save-the-routing-table-on-the-beaglebone-blackangstrom
and
http://mattrichardson.com/BeagleBone-System-Services/

Resources