LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 03-14-2019, 02:14 AM   #1
mrjayviper
LQ Newbie
 
Registered: Mar 2019
Posts: 3

Rep: Reputation: Disabled
How to set a static IP using netplan? (running Ubuntu Bionic server)


I've followed/looked at several guides (like this one) on how to do the above.

My problem is that no static IP is getting assigned to the built-in ethernet port. I have run
Code:
netplan apply
several times. I've also rebooted the PC and still no luck.

I am sure the ethernet port works as I was previously using it on Ubuntu 16.04 just before I decided to fresh install 18.04.2.

Any ideas what I could be doing wrong? I am going to use the ethernet port to connect my main PC to the Ubuntu server via a crossover cable.

If I set the ethernet port to use
Code:
dchp4:true
and connect an ethernet cable from it to my modem/router and disable my WiFi card (by removing the netplan config), the PC can connect to the net without any issues.

Thanks

---------------------------

This is the output of
Code:
netplan --debug apply
which also shows the contents of my YAML files. I have tried with and without dhcp4/dchp6/gateway4/renderer.

screenshot of netplan --debug: https://i.imgur.com/lBIFoa1.jpg
 
Old 03-17-2019, 07:18 AM   #2
krishan25
LQ Newbie
 
Registered: Mar 2019
Posts: 1

Rep: Reputation: Disabled
Static IP address using netplan

To configure Static IP address on your Ubuntu Bionic Server, you have to follow these steps:
1. Go to /etc/netplan/ directory in your server.
2. Now, you have to open a file called “01-netcfg.yaml” or “50-cloud-init.taml”. In this you have to Configure the following things:
• addresses: Here, you have to enter static IP address here for example (192.168.1.50/24)
• Gateway4: Here, you have to enter default gateway IP address for example (192.168.1.1)
• Nameserver: You have to add DNS entry for example (8.8.8.8, 8.8.4.4)
• Dhcp4: no
3. Now, you have to run “sudo netplan apply” command.
4. If there is an issue, you can run “sudo netplan –debug apply” command.

Last edited by krishan25; 03-17-2019 at 07:27 AM.
 
Old 03-19-2019, 07:46 PM   #3
jmgibson1981
Senior Member
 
Registered: Jun 2015
Location: Tucson, AZ USA
Distribution: Debian
Posts: 1,141

Rep: Reputation: 392Reputation: 392Reputation: 392Reputation: 392
My netplan config for reference. Spacing is very important. Do not use tabs. This is configured to use itself for dns.

Code:
network:
 renderer: networkd
 version: 2
 ethernets:
  enp2s0:
   dhcp4: false
   dhcp6: false
   addresses: [192.168.1.2/24]
   gateway4: 192.168.1.1
   nameservers:
    addresses: [192.168.1.2]
A bridge would be similar.

Code:
network:
 renderer: networkd
 version: 2
 ethernets:
  enp2s0:
   dhcp4: false
   dhcp6: false
 bridges:
  br0:
   interfaces: [enp2s0]
   dhcp4: false
   dhcp6: false
   addresses: [192.168.1.2/24]
   gateway4: 192.168.1.1
   nameservers:
    addresses: [192.168.1.2]
No point having the bonds, bridges, vlans tags if you aren't using them. They just are more potential problems that you need to isolate as not being the issue.

Last edited by jmgibson1981; 03-19-2019 at 07:59 PM.
 
Old 03-21-2019, 04:59 AM   #4
patrickjburt
LQ Newbie
 
Registered: Mar 2019
Location: NY, USA
Posts: 2

Rep: Reputation: 0
Good info to know here!!!
 
Old 03-21-2019, 05:04 AM   #5
patrickjburt
LQ Newbie
 
Registered: Mar 2019
Location: NY, USA
Posts: 2

Rep: Reputation: 0
Good info to know here!!!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] A start job is running for Wait for Network to be Configured - netplan Ubuntu 18.04 vincix Linux - Networking 2 03-30-2019 07:59 PM
LXer: How to Use the Netplan Network Configuration Tool on Linux LXer Syndicated Linux News 0 09-09-2018 04:51 AM
LXer: How to configure static IP address on Ubuntu 18.04 Bionic Beaver Linux LXer Syndicated Linux News 0 06-04-2018 07:12 AM
Ubuntu 17.04, netplan, bring up interface without ip da1 Ubuntu 3 01-24-2018 10:04 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 04:41 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration