How to change the DNS server across network interfaces?

62

You can use resolvconf if it isn't already installed use: sudo apt-get install resolvconf.

Then edit the config file: sudo nano /etc/resolvconf/resolv.conf.d/base.
Enter your nameserves (one per line) with: nameserver xxx.xxx.xxx.xxx
Update resolvconf with sudo resolvconf -u

Changes should be permanent and for all interfaces.

Share:
62

Related videos on Youtube

ps0604
Author by

ps0604

Updated on September 18, 2022

Comments

  • ps0604
    ps0604 over 1 year

    Given this code that merges three Pandas data frames:

    raw_data = {
            'type': [0, 1, 1],
            'id': ['3', '4', '5'],
            'name_1': ['Alex', 'Amy', 'Allen']}
    df_a = pd.DataFrame(raw_data, columns = ['type', 'id', 'name_1' ])
    df_a.set_index(['type', 'id'])
    
    raw_datab = {
            'type': [1, 1, 1, 0],
            'id': ['4', '5', '5', '7'],
            'name_2': ['Billy', 'Brian', 'Joe', 'Bryce']}
    df_b = pd.DataFrame(raw_datab, columns = ['type', 'id', 'name_2'])
    df_b.set_index(['type', 'id'])
    
    raw_datac = {
            'name_3': ['School', 'White', 'Jane', 'Homer'],
            'id': ['4', '6', '5', '5'],
            'type': [1, 1, 1, 1]}
    df_c = pd.DataFrame(raw_datac, columns = ['name_3', 'id', 'type' ])
    df_c.set_index(['type', 'id'])
    
    dfx = df_a.merge(df_b, how='outer').merge(df_c, how='outer')
    print(dfx)
    

    I get the following response:

       type id name_1 name_2  name_3
    0     0  3   Alex    NaN     NaN
    1     1  4    Amy  Billy  School
    2     1  5  Allen  Brian    Jane
    3     1  5  Allen  Brian   Homer
    4     1  5  Allen    Joe    Jane
    5     1  5  Allen    Joe   Homer
    6     0  7    NaN  Bryce     NaN
    7     1  6    NaN    NaN   White
    

    What I actually need is to get, as the result, the concatenation of the columns in their original order. For example:

    type    id  name_1  type_2  id_2    name_2  name_3  id_3  type_3  
    0       3   Alex    0       3       NaN     NaN     3     0     
    1       4   Amy     1       4       Billy   School  4     1     
    1       5   Allen   1       5       Brian   Jane    5     1     
    1       5   Allen   1       5       Brian   Homer   5     1     
    1       5   Allen   1       5       Joe     Jane    5     1     
    1       5   Allen   1       5       Joe     Homer   5     1     
    0       7   NaN     0       7       Bryce   NaN     7     0     
    1       6   NaN     1       6       NaN     White   6     1     
    

    Is this possible with Pandas?

    • Hackerman
      Hackerman about 6 years
      When you do these steps: df_b = pd.DataFrame(raw_data, columns = ['type', 'id', 'name_2' ]) you can change the colnames after like df_a.columns = ['type_2','id_2','name_2']...with the right column names for each dataframe, you should get your desired merge result.
    • ps0604
      ps0604 about 6 years
      yes, that worked
    • Hackerman
      Hackerman about 6 years
      Glad to help :)
  • NGRhodes
    NGRhodes almost 10 years
    You need to update resolvconf for the settings to be applied. sudo resolvconf -u
  • Steven Roose
    Steven Roose almost 10 years
    What do I change to the file for adding new DNS nameservers?
  • Steven Roose
    Steven Roose almost 10 years
    (The file is empty when I try to edit it, is that correct?)
  • Pabi
    Pabi almost 10 years
    It is okay that it is empty just write: nameserver xxx.xxx.xxx.xxx.
  • NGRhodes
    NGRhodes almost 10 years
    Pabi, might be worth updating your answer with further details added in these comments :)
  • Nicolay77
    Nicolay77 about 7 years
    use sudo editor file so everyone can load their favourite editor.
  • Scott Boston
    Scott Boston about 6 years
    @petersc Using List Comprehension to set index on all three dataframes. A shortcut instead of using a for loop or writing set_index three different times.