I need to start network interface from command line.I usually do it with the GUI but I don't have desktop manager now.I tried
,it shows ok,but when I try curl or links,it can't connect./etc/init.d/network start
2 Answers
Can you post /etc/sysconfig/network
?
It may be as simple as:
ifup eth0
Fedora 15 uses "Consistent" device naming, which means that your actual device name will likely be something along the lines of em1 or pci3p1 Source
-
it worked but it was pci4p1 not eth0.(Fedora 15).I have no idea why. May 13, 2011 at 15:36
-
@Alexander fedoraproject.org/wiki/Features/ConsistentNetworkDeviceNaming– sciurusMay 13, 2011 at 16:21
-
Ugh. "Consistent" network device naming. Consistent with absolutely no other distribution, that's what.– HyppyMay 13, 2011 at 16:25
-
Hyppy,can you add the link in the answer for anybody else using Fedora 15 May 13, 2011 at 17:18
In Fedora there is a service called NetworkManager.service that automatically makes sure you are connected to the internet as defined in: /etc/sysconfig/network-scripts/ifcfg-em1
Run this command as root to check the status of this service:
systemctl status NetworkManager.service
If it is disabled, enable it, or find out why it was disabled:
systemctl enable NetworkManager.service
Then either reboot the computer or restart the network.service manually:
systemctl restart network.service
Here is the contents of my /etc/sysconfig/network-scripts/ifcfg-em1
UUID="e1a84d44-b53c-43ef-a8b4-df5ce5263ebc"
NM_CONTROLLED="yes"
HWADDR="A8:50:F2:E2:05:7E"
BOOTPROTO="dhcp"
DEVICE="em1"
ONBOOT="yes"
USERCTL="yes"
You would roll your own 'restart network' scripts only if the available ones are non functional or are not adequate for a specific task.
Source:
http://danielgibbs.co.uk/2012/06/fedora-17-set-static-ip-address/